Meteor Pub/Sub Speed

Hi @robfallows, I don’t know what happened yesterday, but today I tried again enabling the debug option that you told me and the times now improved up to 445 ms. I also tried it removing that debug option and it works as well very good. So, I guess that it was a cache issue because yesterday (today at dawn), I turned off the computer and some moments ago when I started to work I realized that this issue has gone. Anyway , I share you the new results:

10 concurrent clients, 10 Requests, 10 seconds of interval (METHODS AND PUBLICATIONS)*

Subscriptions

Time taken for subscription in client 1:  445.5281509999186
Time taken for subscription in client 6:  445.46779000014067
Time taken for subscription in client 7:  445.9010189999826
Time taken for subscription in client 9:  429.4299780000001
Time taken for subscription in client 4:  420.2433619997464
Time taken for subscription in client 3:  443.3406929997727
Time taken for subscription in client 2:  447.0298079997301
Time taken for subscription in client 8:  420.7044619997032
Time taken for subscription in client 5:  309.21008299989626
Time taken for subscription in client 10:  310.3988119997084

Meteor calls:

[
Results for request 1 : {
  numberOfRequest: 1,
  avgTimeTaken: 61.03509820005856,
  minTime: 10.975011999718845,
  maxTime: 70.87719300016761,
  successfulRequests: 10,
  failedRequests: 0
}
Results for request 2 : {
  numberOfRequest: 2,
  avgTimeTaken: 58.72967820009217,
  minTime: 21.770369000267237,
  maxTime: 111.31068199966103,
  successfulRequests: 10,
  failedRequests: 0
}
Results for request 3 : {
  numberOfRequest: 3,
  avgTimeTaken: 167.0187597999349,
  minTime: 17.817210000008345,
  maxTime: 228.7032280000858,
  successfulRequests: 10,
  failedRequests: 0
}
Results for request 4 : {
  numberOfRequest: 4,
  avgTimeTaken: 71.68885270007885,
  minTime: 13.43011899990961,
  maxTime: 87.830496000126,
  successfulRequests: 10,
  failedRequests: 0
}
Results for request 5 : {
  numberOfRequest: 5,
  avgTimeTaken: 71.17948650000616,
  minTime: 17.30956199998036,
  maxTime: 87.06555800000206,
  successfulRequests: 10,
  failedRequests: 0
}
Results for request 6 : {
  numberOfRequest: 6,
  avgTimeTaken: 67.00262760007755,
  minTime: 13.716463999822736,
  maxTime: 82.49117900012061,
  successfulRequests: 10,
  failedRequests: 0
}
Results for request 7 : {
  numberOfRequest: 7,
  avgTimeTaken: 70.84416559990495,
  minTime: 17.489858000073582,
  maxTime: 85.67751999991015,
  successfulRequests: 10,
  failedRequests: 0
}
Results for request 8 : {
  numberOfRequest: 8,
  avgTimeTaken: 73.16472599995322,
  minTime: 13.366837000008672,
  maxTime: 122.36361799994484,
  successfulRequests: 10,
  failedRequests: 0
}
Results for request 9 : {
  numberOfRequest: 9,
  avgTimeTaken: 75.73795940000564,
  minTime: 16.54201600002125,
  maxTime: 129.43410700000823,
  successfulRequests: 10,
  failedRequests: 0
}
Results for request 10 : {
  numberOfRequest: 10,
  avgTimeTaken: 70.25964430002496,
  minTime: 12.963732999749482,
  maxTime: 110.25433599995449,
  successfulRequests: 10,
  failedRequests: 0
}
]

Moreover, I did the load test for 1000 concurrent clients.
1000 concurrent clients, 10 Requests, 10 seconds of interval (METHODS AND PUBLICATIONS)*

Subscriptions of the last clients

Time taken for subscription in client 977:  175946.264341
Time taken for subscription in client 348:  175987.54527599993
Time taken for subscription in client 972:  176081.448846
Time taken for subscription in client 377:  176123.11316399998
Time taken for subscription in client 334:  176221.41655099997
Time taken for subscription in client 980:  176255.46911499999
Time taken for subscription in client 973:  176341.37670799997
Time taken for subscription in client 360:  176379.1776690001
Time taken for subscription in client 981:  176465.82012200006
Time taken for subscription in client 943:  176491.87424100004
Time taken for subscription in client 693:  176584.81760299997
Time taken for subscription in client 368:  176621.36927999998
Time taken for subscription in client 969:  176714.54778699996
Time taken for subscription in client 994:  176759.301737
Time taken for subscription in client 689:  176872.626225
Time taken for subscription in client 987:  176820.23303800006
Time taken for subscription in client 982:  176917.00307099987
Time taken for subscription in client 927:  176947.63937
Time taken for subscription in client 672:  176970.14291299996
Time taken for subscription in client 941:  177051.04385699984
Time taken for subscription in client 352:  177072.20980499987
Time taken for subscription in client 975:  177175.47673300002
Time taken for subscription in client 379:  177199.3791469999
Time taken for subscription in client 366:  177297.74972199998
Time taken for subscription in client 970:  177348.21058699978
Time taken for subscription in client 337:  177434.72009900003
Time taken for subscription in client 700:  177465.49679800007
Time taken for subscription in client 697:  177601.61794899986
Time taken for subscription in client 990:  177649.50490399986
Time taken for subscription in client 998:  177762.87450499996
Time taken for subscription in client 692:  177807.72967600008
Time taken for subscription in client 1000:  178285.01405300014
Time taken for subscription in client 687:  178328.0034409999
Time taken for subscription in client 324:  178410.61048100004
Time taken for subscription in client 335:  178421.2314149998

Meteor calls

[

Results for request 1 : {
  numberOfRequest: 1,
  avgTimeTaken: 751.7459187650047,
  minTime: 18.792495999950916,
  maxTime: 2213.0597669999115,
  successfulRequests: 1000,
  failedRequests: 0
}
Results for request 2 : {
  numberOfRequest: 2,
  avgTimeTaken: 371.13168233300394,
  minTime: 9.648470000131056,
  maxTime: 840.8615360001568,
  successfulRequests: 1000,
  failedRequests: 0
}
Results for request 3 : {
  numberOfRequest: 3,
  avgTimeTaken: 402.07523262600273,
  minTime: 6.867186999879777,
  maxTime: 1037.922288000118,
  successfulRequests: 1000,
  failedRequests: 0
}
Results for request 4 : {
  numberOfRequest: 4,
  avgTimeTaken: 315.560863475,
  minTime: 7.926362000172958,
  maxTime: 1079.4915559999645,
  successfulRequests: 1000,
  failedRequests: 0
}
Results for request 5 : {
  numberOfRequest: 5,
  avgTimeTaken: 357.83813744699444,
  minTime: 8.717160000000149,
  maxTime: 1022.7089849999174,
  successfulRequests: 1000,
  failedRequests: 0
}
Results for request 6 : {
  numberOfRequest: 6,
  avgTimeTaken: 354.4931812609974,
  minTime: 7.905716000124812,
  maxTime: 1128.5242329998873,
  successfulRequests: 1000,
  failedRequests: 0
}
Results for request 7 : {
  numberOfRequest: 7,
  avgTimeTaken: 335.77551549999765,
  minTime: 8.037420999957249,
  maxTime: 919.1722240000963,
  successfulRequests: 1000,
  failedRequests: 0
}
Results for request 8 : {
  numberOfRequest: 8,
  avgTimeTaken: 362.35641557200046,
  minTime: 7.212625999934971,
  maxTime: 908.6056140000001,
  successfulRequests: 1000,
  failedRequests: 0
}
Results for request 9 : {
  numberOfRequest: 9,
  avgTimeTaken: 282.81889771800513,
  minTime: 7.242529999930412,
  maxTime: 921.8009089999832,
  successfulRequests: 1000,
  failedRequests: 0
}
Results for request 10 : {
  numberOfRequest: 10,
  avgTimeTaken: 309.1819974879979,
  minTime: 7.449139999924228,
  maxTime: 1079.2336809998378,
  successfulRequests: 1000,
  failedRequests: 0
}
]

Everything seems to be working normally now!!!.

Note: These tests are using authenticated clients, meteor methods with middlewares to check permissions and access to database, so, I think those times are excellent.

Hardware information:
RAM assigned to the meteor app: NODE_OPTIONS=–max-old-space-size=8196
Machine: Mac Book Pro (16-Inch, 2019), core i7, 16gb

I don’t see why you need to use a reactive aggregate for your publication. Surely you could just rework it do a find on the audios collection by user I’d and bypass the link to meteor users. That will be faster

I agree that sounds better, but it’s not my publication.