firebase-admin-java
firebase-admin-java copied to clipboard
performance firebase-admin-java (9.2.0)
- Library version: 9.2.0
- Firebase Product: Messaging
In one of the firebase-admin-java PR mentioned that, sendEach sends one HTTP request to V1 Send endpoint for each message in the array. sendAll sends only one HTTP request to V1 Batch Send endpoint to send all messages in the array.
- But after comparing the debug logs of both calls, I discovered that they both make the same number of HTTP calls for the same number of device tokens. So what's the improvement in the new
sendEachmethod? - I have tried to understand the difference between the
sendEachAsyncandsendEachForMulticastAsyncmethods in terms of performance. However, both methods seem to make the same number of REST calls to FCM based on the number of device tokens in the message. Can you clarify this further? - Is there a method similar to the BATCH endpoint where only one REST call is made for multiple device tokens?
- Once we upgrade to the latest version of firebase-admin (9.2.0) from our current version (7.0.1), will there be any performance improvements in terms of the number of REST calls made to FCM? Are there any other benefits to upgrading to the latest version with respect to the client application? (Aside from the deprecated batch endpoint, are there any other changes?)
I appreciate your response.
Hi @KrishnakanthYachareni,
Sorry for the late response!
-
sendEachmethod uses FCM V1 send API, whereassendAlluses FCM Batch send API which is going to be decommissioned soon in 2024.sendEachis expected to not have any performance improvement oversendAll. - We don't expect performance differences between the
sendEachAsyncandsendEachForMulticastAsyncmethods. Essentially speaking, bothsendEachAsyncandsendEachForMulticastAsyncmethods are wrappers ofsendmethod except that they provide a more convenient API for sending multiple messages. - No. We recommend using Topic messaging to send to multiple devices. Please see https://firebase.google.com/docs/cloud-messaging/android/send-multiple#java for details.
- No performance improvements in terms of REST calls to FCM. The benefit of an upgrade is to get rid of the usage of the deprecated batch endpoint, which is necessary after the endpoint is shut down.