plugin-QueuedTracking icon indicating copy to clipboard operation
plugin-QueuedTracking copied to clipboard

Redis full memory

Open nnhiep opened this issue 1 year ago • 5 comments

We are enabling a Queue Tracking using Redis, but I'm facing an issue where Redis memory usage continuously increases. I've even set it to 40GB of RAM, but it still gets full. I have 10 web servers, and I've configured 16 workers and a number of requests as 10 as shown in the image below. With this configuration, how many worker processes are there on each web server? How can I optimize Queue Tracking in this case? Screen Shot 2024-05-02 at 22 55 42

nnhiep avatar May 02 '24 15:05 nnhiep

Hi @nnhiep . I'm sorry to hear that you're experiencing this problem. If you have a cron configured on each server, I would expect there to be 16 workers per server. Once you installed the plugin and configured it, did you schedule a cron to trigger processing of the queue? Please see the FAQ about setting up queued tracking, specifically step 7 about setting a cron. You can also manually trigger processing using the command provided in step 7 ./console queuedtracking:process and it will output useful debugging info if you add the -vvv option to the end of the command. The default number of requests to process per batch is 25, so I wouldn't think that you'd want to go under that if processing isn't keeping up with incoming requests.

snake14 avatar May 02 '24 21:05 snake14

Hi @snake14, Thank you for your suggestion about the number of requests to process per batch, I will adjust it back to the default. For number worker process, I don't configure cron to manually run the worker process, I only configure in one place in General Settings. This is the result when I run the monitor on each server; I didn't see any document that says that each web server has 16 workers, or that the 16 workers will be evenly distributed among the web servers.

# ./console queuedtracking:monitor
Queue is enabled
Request sets in the queue will be processed automatically after a tracking request
Up to 16 workers will be used
Processor will start once there are at least 25 request sets in the queue
2210319 (150332+122563+126616+110840+155440+139562+146586+139548+165556+140315+151136+103374+128405+117966+158488+153592) request sets left in queue. 6.39G used memory (34.47G peak). 16 workers active.   2209769 (150322+122505+126554+110801+155392+139541+146571+139529+165504+140300+151119+103334+128335+117927+158500+153535) request sets left in queue. 6.39G used memory (34.47G peak). 16 workers active.

nnhiep avatar May 02 '24 23:05 nnhiep

Hi @nnhiep . Sounds good. If that doesn't start catching up with the queue, you might increase the number of requests per batch even further.

I see from the monitor console command output that you have the Process during tracking request option enabled. So, you shouldn't have to set up the cron like I mentioned in my previous comment. I think that since you're using that setting, it should trigger the processing on whichever server receives the tracking request and 16 workers will be used. If you have multiple servers receiving tracking requests, I believe that each server should have 16 workers.

snake14 avatar May 03 '24 04:05 snake14

Hi @snake14

I don't think every web server has 16 workers. Is there a way to accurately check the number of workers on each server?

nnhiep avatar May 03 '24 08:05 nnhiep

Hi @nnhiep. If the server has Matomo installed on it, you should be able to run ./console queuedtracking:monitor on it. If you manually run ./console queuedtracking:process -vvv, it should tell you how many workers are used. When you said that you had 10 web servers did you mean each one was running Matomo or did you mean that you have 10 web servers sending tracking requests to a single Matomo instance? If the latter, you'll only have 16 workers on that single Matomo instance.

snake14 avatar May 05 '24 21:05 snake14

Hi @snake14

I have 10 web servers running Matomo. My question is whether the 16 workers will be evenly distributed across 10 matomo web servers, or if each matomo web server will have 16 workers.?

nnhiep avatar May 06 '24 10:05 nnhiep

Hi @nnhiep . The processing is executed on each configured Matomo instance configured to process the queue. So, if each server has a configured installation of Matomo, then each should use 16 workers when queue processing is triggered on that server.

snake14 avatar May 06 '24 21:05 snake14

Thanks @snake14

I tried using Redis queue on each web server, and it worked very well. My problem has been solved.

nnhiep avatar May 21 '24 03:05 nnhiep

You're most welcome @nnhiep . I'm glad that you were able to get it working :+1:

snake14 avatar May 21 '24 05:05 snake14