Make a small contribution to the C #. Net brothers-nosql leveldb. Net transplanted version of the general PC 1 million data insertion does not exceed 4 seconds
Multi-thread and concurrent Security
Solution:
Http://pan.baidu.com/share/link? Consumer id = 508379 & UK = 201606611
If you have any questions, please contact: QQ chat group 204725117
Leveldb is a key/value pair (key/Value Pair) embedded database management system programming library developed by Google. It is released with an open-source BSD license [1.
High Performance and simple architecture: Only API calls are supported, and SQL languages are not supported.
Free software and open source software
Data can be compressed by the snappy library to reduce disk I/O and improve efficiency.
Currently, only Linux is fully developed by C ++ and supports TB-level data. This project will be transplanted to Windows and. Net platforms!
Example of calling code:
Using system; using system. collections. generic; using system. LINQ; using system. text; using system. io; using websystem. framework. dao. leveldb; namespace leveldbdemo {class program {static DB database {Get; set;} static string databasepath {Get; set;} static void main (string [] ARGs) {var temppath = path. gettemppath (); var randname = path. getrandomfilename (); databasepath = path. combine (temppath, randname); cache c = new cache (100*1024*1024); var Options = new options () {blockcache = C, createifmissing = true ,}; database = new dB (options, "mylevel. DB "); // start time timespan runtime = new timespan (datetime. now. ticks); // insert 1 million K, V for (INT I = 0; I <1000000; I ++) {database. put (I. tostring (), I. tostring () + "A");} // retrieve all data by iteration // var entries = new list <keyvaluepair <string, string> (); // try // {// foreach (VAR entry in Database) // {// entries. add (entry); //} // catch {} // obtain the value of a key string value = database. get ("123455"); // around 0.00x seconds // End Time timespan timenow = new timespan (datetime. now. ticks); // time interval timespan Ts = timenow. subtract (runtime ). duration (); console. writeline ("time used:" + ts. totalseconds. tostring () + "seconds" + ts. totalmilliseconds. tostring () + "millisecond ");}}}
Copyright: Alibaba Cloud search Development Team