Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With multiple workers most of the requests are put into trackingQueueV1 #188

Closed
kevinkopf opened this issue Aug 27, 2022 · 2 comments
Closed

Comments

@kevinkopf
Copy link

kevinkopf commented Aug 27, 2022

Steps to reproduce:

  1. Use JavaScript tracker
  2. Do not use the log importer
  3. Provider plugin not installed
  4. Install the plugin
  5. Set up tracking with Redis
  6. Set up 16 workers through GUI
  7. Go play some minecraft until you almost lose your job. Just to pass time, you know 😅
  8. Run ./console queuedtracking:monitor

Result:
trackingQueueV1 has substantionally more requests, than other queues. The option "Process during tracking request" seemingly does not affect the queue number. At least I haven't noticed any correlation.
image

Similar problem was reported here as well:

2808222 (0+2807543+0+0+0+0+675+4) request sets left in queue. 3.62G used memory (3.62G peak). 1 workers active.

and maybe a couple of other places I cant recall now. I managed to track the uneven distribution of requests to this function.

Now I know, that @tsteur said here

Generally, Matomo will put all requests for the same User, Visitor and IP address into the same queue.

My question is: Is there a specific reason to do it like so? I mean, putting all requests for the same User, Visitor and IP address into the same queue. Wouldn't it be better to try to evenly distribute the requests among queues? Are there specific relations, that might break if we don't put it into the same queue?

If not, I'd go with a simple rand, which statistically would ensure uniform distribution of requests:

    protected function getQueueIdForVisitor($visitorId)
    {
        return rand(0, $this->numQueuesAvailable - 1);
    }

simply keeping $visitorId for backwards compatibility for now.

@snake14
Copy link
Contributor

snake14 commented Aug 28, 2022

Hi @kevinkopf . Thank you for taking the time to create this issue. I have confirmed that is the expected behaviour. Matomo tries to split the requests as evenly as possible between queues, but it also tries to keep requests from the same visitor/user in the same queue. We do this to ensure that we can replay events in the correct order.

I'm marking this issue as closed, but please feel free to let me know if you think there's cause to have it re-opened or if you have any further questions.

@snake14 snake14 closed this as completed Aug 28, 2022
@heurteph-ei
Copy link

Hi @snake14, @kevinkopf
Maybe the problem comes from another reason. See for example:
https://forum.matomo.org/t/urgent-queued-tracking-assistance-needed/41014/3
I think this should be added somewhere in the QueuedTracking FAQ (and plug-in FAQ in marketplace)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants