LevelDB. NET performance test,
Recently learned about LevelDB, found that the embedded K-V data performance is good, so by the way want to know about the use level. because LevelDB is also targeted. net implementation, so it is targeted at LevelDB. NET to perform a simple read/write stress test. in order to more objectively reflect the test structure, a large amount of data is added, and a random KEY is used during the GET operation.
Set operation
?
1234567891011121314151617181920 |
public static void WriteTest( object state) { while ( true ) { User user = new User(); string id = GetKey().ToString( "000000000000000000000" ); user.Name = id; user.EMail = id + "@msn.com" ; user.CrateTime = DateTime.Now; user.City = "GZ" + id; user.Country = "CN" + id; user.Address = "sdfffffffffffffffffffffffffafjsdfjsljfsjfls" +id; user.Phone = id; user.Region = "gd" ; db.Set(user.Name, user); System.Threading.Interlocked.Increment( ref mCount); } } |
Get operation
?
12345678910111213141516 |
while ( true ) { User user; int index = ran.Next(100000, 500000); if (index == li) { Console.WriteLine(index); } li = index; user = db.Get<User>(index.ToString( "000000000000000000000" )); System.Threading.Interlocked.Increment( ref mIndex); System.Threading.Interlocked.Increment( ref mCount); } |
Summary
LevenDB. net write speed is very efficient, in the case of a single thread write can reach nearly 5 W/second efficiency, in terms of obtaining efficiency, the concurrent reading of five threads can reach the capability of 15 W/second .... this reading effect is quite impressive.