开发者

Efficient way to access a Redis database

开发者 https://www.devze.com 2023-03-14 17:05 出处:网络
In some of my applications access to Redis seems to become a bottleneck. Currently there are two ways to make access more efficient. Pipelining and accessing Unix sockets instead of TCP.

In some of my applications access to Redis seems to become a bottleneck. Currently there are two ways to make access more efficient. Pipelining and accessing Unix sockets instead of TCP.

But isn't there in even more efficient way to access it? More like a开发者_StackOverflow library, like when you are dealig with BDB or Toky Cabinet? Or maybe something else.


If redis is a bottleneck, you probably have something quite wrong with either your configuration or the type of query you are using. Some things to check:

  • using MGET will be a lot faster than several GET commands - minimize the number of separate requests
  • use threading and multiple connections - a single connection has to wait for one command to return before it can process the next. If the second command is unrelated, it should not have to wait.
  • Make sure you have VM and saving configured correctly - if something is set up wrong, red is can end up using system virtual memory, which really kills performance.
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号