Vtocc is the first available product of vitess. It serves as a frontend for MySQL, providing an RPC interface to receive SQL statements and transform them. It offers efficient handling of multiple large-scale database operation requests, with a concurrency processing capability of over 10k+. It also provides an SQL parser that allows the server to understand and intelligently optimize queries.
Vtocc has been used in large-scale production environments and is the core of YouTube's new MySQL service architecture.
Example code:
from vtdb import vt_occ2 as db
conn = db.connect('localhost:6510', timeout=5, dbname='mydb')
curs = conn.cursor()
curs.execute('select * from mytable limit 5', {})
print curs.description
for v in curs:
print v
print curs.rowcount
Main features:
A Python DBAPI 2.0 compatible client interface (vt_occ2.py)
Understanding various HTTP and TCP-based protocols
Support for query variables and query caching to avoid repetitive SQL parsing and reuse query plans
Connection pooling
Transaction management, with the ability to limit concurrent transactions and manage transaction failures
DML annotations: Each DML will be rewritten and include a comment field at the end to identify the modified row records
Built-in fault tolerance
Query merging: The ability to reuse the results of an in-flight query for any subsequent requests received while the query is still executing
Ability to limit the number of query results, with an error thrown if exceeded
Ability to delete excessively long transactions
Ability to delete excessively long queries
Automatic cleanup of idle connections
Vtocc modules:
Method to obtain the source code: hg clone https://code.google.com/p/vitess/
Through Vtocc - High Performance MySQL Frontend - Open Source China.