標籤:http 使用 os io 檔案 資料 ar 2014
最近關注了一下ssdb,他的特點是基於檔案儲存體系統所以它支撐量大的資料而不因為記憶體的限制受取約束.從官網的測試報告來看其效能也非常出色和redis相當,因此可以使用他代表redis來進行k-v資料業務的處理.想法總是美好的,不過現實中就可能非常骨感.
以於針對Redis和ssdb的幾個讀操進行一個簡單的效能測試對比,這個測試不是直接在本機調用Redis和ssdb. 而是通過一個程式在別的伺服器上調用.測試指令(get,hget,lregion)以下是測試結果
測試代碼
private void HGetHandler(RedisClient e) { while (mRuning) { long index = System.Threading.Interlocked.Increment(ref mIndex); 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(ref mCount); } } private void LRegionHandler1TO2(RedisClient e) { while (mRuning) { ProtobufList<Model.Order> list = "Orders"; list.Range(1, 2, e); System.Threading.Interlocked.Increment(ref mCount); } } private void LRegionHandler50TO60(RedisClient e) { while (mRuning) { ProtobufList<Model.Order> list = "Orders"; list.Range(50, 60, e); System.Threading.Interlocked.Increment(ref mCount); } } private void LRegionHandler100TO110(RedisClient e) { while (mRuning) { ProtobufList<Model.Order> list = "Orders"; list.Range(100, 110, e); System.Threading.Interlocked.Increment(ref mCount); } } private void GetHandler(RedisClient e) { while (mRuning) { long index = System.Threading.Interlocked.Increment(ref mIndex); ProtobufKey key = "user_" + Data.Import.Users[(int)(index % Data.Import.Users.Count)].Name; key.Get<Model.User>(e); System.Threading.Interlocked.Increment(ref mCount); } }
從測試結果看來差距還是非常明顯,並不象官網那樣說得這麼理想.雖然SSDB效率上不如REDIS,但其基於磁碟儲存有著其最大的優勢,畢竟很多業務資料遠超過伺服器記憶體的容量.