instedd / verboice

Open source toolkit for voice services; with special focus to the needs of medium- and low-income countries, scalable services, and interacting with vulnerable populations
http://verboice.instedd.org/
GNU General Public License v3.0
45 stars 18 forks source link

Optimize usage of address book in Verboice #944

Closed manumoreira closed 8 months ago

manumoreira commented 9 months ago

For Verboice clients that drive Verboice programmatically, the address book is an unused feature that penalizes their performance

matiasgarciaisaia commented 8 months ago

Here's the loop that traverses the whole address book for the project, which can grow to be large when using Surveda (we got +2M contacts some times).

This is, however, not used during normal Survda operation - that code is only used when queueing calls from the Project view page in Verboice itself (/projects/:id), and not via the API.

matiasgarciaisaia commented 8 months ago

I've just confirmed in Surveda Africa (running Verboice 3.5.1) that queueing a call from Projects (with 86k contact addresses) takes ~5.2 seconds (spending 5 seconds in this first loop - of which "only" 450ms where in ActiveRecord), but queuing a call in that same project via Surveda only took 260ms.

So there's an optimization to be done in the Project Controller, but it's not a major issue for Surveda itself.

anaPerezGhiglia commented 8 months ago

closed by #945