![]() LRANGE, SMEMBERS, ZRANGE, etc.) and/or use big pipelines. It is best to use hiredis when you have large replies (for example: Because it is a CĮxtension, JRuby is not supported (by default). Optimizes for speed, at the cost of portability. Hiredis-rb is a binding to the official hiredis client library. ![]() The hiredis driver uses the connection facility of hiredis-rb. Improper use of inherit_socket will result in corrupted and/or incorrectīy default, redis-rb uses Ruby's socket library to talk with Redis. your own code prevents the parent process from using the redis. ![]() many short-lived forked children of one process need to talk.Inherit_socket: true: disable safety check that prevents a forked childįrom sharing a socket with its parent this is potentially useful in order to mitigate connection churn when: new ( :url =>, :ssl_params => ) Expert-Mode Options I measured on a MacBook Air 13 inch from 2014, intel Core i7 / 1.7 GHz, Yosemite 10.10.3, 8 GB ram with Redis 3.0.1.Redis = Redis. To make it easy to reproduce my results, I have published the source code for my benchmark including instructions and version numbers on GitHub. Please mind that the benchmark is very simple and therefore can not support statements like "Crystal is faster than C" or something like that.Ĭrystal's performance combined with the beautiful syntax and the new great concurrency primitives (spawn / channels just like Go) make the language very promising for me. I assume this is caused by the printf style API. Why it gets defeated by other clients I can only guess. In theory, C with Hiredis should be the top performer. ![]() On the other hand Java performed very well - better than C. Disappointingly Javascript wasn't capable of executing the benchmark as described and I had to split the 1,000,000 commands in 10 pipelines of 100,000 commands each. Fortunately, the C/Hiredis driver changes the picture.įor Javascript, I tried both Node.js and io.js. Using redis-rb with a plain Ruby driver is sad. Ruby's redis-rb client supports different drivers and performs accordingly. awesome!īut also the other results I find fascinating. This graph makes the numbers easier to grasp:Ĭrystal-Redis takes the performance crown. ResultsĪfter these improvements and measuring more clients/languages, the results are: Language Surprisingly, Go with the Redigo library outperformed C with Hiredis, the officially recommended client library for C.Īry, the Crystal founder, was so friendly to help with Crystal-Redis' performance and tweaked Crystal itself - which improved the result greatly. Since I was learning Go on the side, I ported this benchmark to two Go clients. ![]() As hoped and expected, Crystal was much faster than Ruby, and slightly slower than C. Initially, I measured Crystal-Redis against Ruby and C. It focuses the measurement on the overhead caused by the client library and by the programming language. This is great for a benchmark because it minimizes the impact of the operating system. Pipelining means that the client queues up all requests, sends them in one big batch, and then receives all responses in another batch. 1 Try updating the version of redis in gemfile or downgrading the version of active jobs or sidekiq in gemfile. The benchmark does the following: It connects to Redis and performs 1,000,000 Redis commands SET foo bar in pipeline mode. I built a simple benchmark and ported it.įirst I measured Crystal against Ruby and C, but then I enjoyed the process and compared also against Go, Node.js and Java. In order to know where I stand with the library, I needed to compare Crystal-Redis with other client libraries in other programming languages. Since the major reason to use Redis and Crystal is performance, I wanted to make Crystal-Redis fast. Recently, I have published a Redis client library for Crystal called Crystal-Redis. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |