Recently focused on the SSDB, which is characterized by a file storage system so it supports large amounts of data without being constrained by memory constraints. From the test report on the official website, the performance is excellent and the Redis equivalent, It can therefore be used instead of redis for processing k-v data services. The idea is always good, but in reality it can be a bit of a bone.
Fortunately Ssdb is part of a REDIS-compliant protocol, so a stress test can be done directly with the Redis client library. To perform a simple performance test comparison of several reads for Redis and SSDB, this test does not call Redis and ssdb directly on the native computer. Instead, it is invoked on a different server through a program. Test instruction (Get,hget,lregion) The following is the test result
?
Test code
classTest {LongMCount =0; LongMindex =0; Private BOOLMruning =true; Public LongCount {Get { returnMCount; } } Public voidExecute () {Console.WriteLine ("* -----------------------------------------------"); Console.WriteLine ("* Redis Get"); Consolewait.start (); stringresult =ontest (Config.redisclient,gethandler); Consolewait.end (); Console.WriteLine (result); Console.WriteLine ("* Ssdb Get"); Consolewait.start (); Result=ontest (config.ssdbclient, gethandler); Consolewait.end (); Console.WriteLine (result); Console.WriteLine ("* -----------------------------------------------"); //Console.WriteLine ("* Redis Lregion[1-2]"); Consolewait.start (); Result=ontest (config.redisclient, Lregionhandler1to2); Consolewait.end (); Console.WriteLine (result); Console.WriteLine ("* Ssdb Lregion[1-2]"); Consolewait.start (); Result=ontest (config.ssdbclient, Lregionhandler1to2); Consolewait.end (); Console.WriteLine (result); Console.WriteLine ("* -----------------------------------------------"); //Console.WriteLine ("* Redis lregion[50-60]"); Consolewait.start (); Result=ontest (config.redisclient, Lregionhandler1to2); Consolewait.end (); Console.WriteLine (result); Console.WriteLine ("* Ssdb lregion[50-60]"); Consolewait.start (); Result=ontest (config.ssdbclient, Lregionhandler1to2); Consolewait.end (); Console.WriteLine (result); Console.WriteLine ("* -----------------------------------------------"); //Console.WriteLine ("* Redis lregion[100-110]"); Consolewait.start (); Result=ontest (config.redisclient, Lregionhandler1to2); Consolewait.end (); Console.WriteLine (result); Console.WriteLine ("* Ssdb lregion[100-110]"); Consolewait.start (); Result=ontest (config.ssdbclient, Lregionhandler1to2); Consolewait.end (); Console.WriteLine (result); Console.WriteLine ("* -----------------------------------------------"); //Console.WriteLine ("* Redis Hget"); Consolewait.start (); Result=ontest (config.redisclient, Hgethandler); Consolewait.end (); Console.WriteLine (result); Console.WriteLine ("* Ssdb Hget"); Consolewait.start (); Result=ontest (config.ssdbclient, Hgethandler); Consolewait.end (); Console.WriteLine (result); Console.WriteLine ("* -----------------------------------------------"); } Private voidHgethandler (redisclient e) { while(mruning) {Longindex = System.Threading.Interlocked.Increment (refMindex); Protobufkey Key="User_"+ data.import.users[(int) (Index%Data.Import.Users.Count)]. Name; Key. Get<model.order, Model.employee, model.customer>(e); System.Threading.Interlocked.Increment (refmCount); } } Private voidLregionhandler1to2 (redisclient e) { while(mruning) {protobuflist<Model.Order> list ="Orders"; List. Range (1,2, E); System.Threading.Interlocked.Increment (refmCount); } } Private voidlregionhandler50to60 (redisclient e) { while(mruning) {protobuflist<Model.Order> list ="Orders"; List. Range ( -, -, E); System.Threading.Interlocked.Increment (refmCount); } } Private voidlregionhandler100to110 (redisclient e) { while(mruning) {protobuflist<Model.Order> list ="Orders"; List. Range ( -, the, E); System.Threading.Interlocked.Increment (refmCount); } } Private voidgethandler (redisclient e) { while(mruning) {Longindex = System.Threading.Interlocked.Increment (refMindex); Protobufkey Key="User_"+ data.import.users[(int) (Index%Data.Import.Users.Count)]. Name; Key. Get<Model.User>(e); System.Threading.Interlocked.Increment (refmCount); } } Private stringOnTest (Redisclient client,action<redisclient>handler) {MCount=0; Mruning=true; for(inti =0; I < -; i++) {System.Threading.ThreadPool.QueueUserWorkItem (o)={gethandler ((redisclient) o); }, client); } ints = -; while(S >0) {System.Threading.Thread.Sleep ( +); S--; } mruning=false; System.Threading.Thread.Sleep ( +); return string. Format ("* [seconds:{1}/total:{0}]", MCount, MCount/ -); } }
From the test results it seems that the gap is still very obvious, not as the official website said so ideal. Although SSDB is less efficient than Redis, its disk-based storage has the greatest advantage, after all, much of the business data exceeds the capacity of server memory.
SSDB test results are not ideal may be the hardware environment is limited, if there is an SSD drive test environment estimates also get a better result, but in the test process found a problem is ssdb occupied CPU resources is also very large, in the above test process ssdb concurrency efficiency is not comparable to Redis, At the same time, the CPU loss is almost one-fold higher than redis.
The above test results are closely in some cases of performance test comparison, can not fully express the difference between the two in the application of the results, if the need to use these products students do not have to carry out some tests before implementation to provide a more reliable results.