I have a Laravel app (iOS API) that pushes data to SQS to be processed in the background. Depending on the request, we need to dispatch anywhere from 1 to 4 jobs to SQS. For example:
Dispatch a job to SQS, to be processed by a Worker:
- for connecting to a socket service (Pusher)
- for connecting to Apple's APNS service (Push Notifications)
- for sending data to Loggly for basic centralized request logging
- for storing analytics data in a SQL database (for the time being)
The problem is, we might have a feature like "chat", which is a pretty light request as far as server processing is concerned, however it needs to connect to SQS three times over to send:
- 1) Socket push to all the devices
- 2) Analytics processing
- 3) Centralized Request / Error Logging
In total, these connections end up doubling or tripling the time that the rest of request takes. ie. POSTing to /chat
might otherwise take about 40-50ms, but with SQS, it takes more like 100 - 120ms
Should i be approaching this differently? Is there a way batch these to SQS so we only need to connect once rather than 3 times?
via djt