Answer the question
In order to leave comments, you need to log in
data processing in redis
I'm learning redis.
I want to calculate the ratio of files, as the ratio of the traffic they generated to their size.
There are htraff and nsize hashes, the key is the file name, value, respectively, traffic and size. To calculate the ratio, now I use the following code:
$hsize=$redis->hGetAll("hsize");
$htraff=$redis->hGetAll("hraff");
foreach ($v as $hash=>$size)
$redis->zAdd("hratio",$htraff[$date][$hash]/$size,$hash);
Answer the question
In order to leave comments, you need to log in
I'm no expert, but the latest Redis has support for LUA stored procedures, maybe this will help?
I was looking for some testing of radish and other databases. I found one in which the author claimed that the muscle is an order of magnitude slower. But in the ensuing discussion, the author was presented with indisputable evidence of the incorrectness of the measurements taken. And the discussion came to the conclusion that neither muscle nor postgre are practically inferior in performance to radish.
Therefore, the only advantage of radish is ease of use. If it is necessary to include calculations on the server in the task, then here I see one solution - abandoning the radish in favor of the muscle or postgre.
read the article at the link and all the comments - it's worth it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question