You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to MailChimp API Best Practices, they recommend that API calls be made as async background processes. This is to avoid times when the user might experience a long wait, as a response is expected from the MC API that might take a few seconds.
Currently this Guzzle HTTP library implementation uses request() exclusively, and as such all requests including Update and Create, are done synchronously, which means the end user will be required to wait for the response and its result. This leads to poor user experience, and in my case, I was seeing GuzzleHTTP reporting open connections of 15 seconds to the API. (This might be fixable just by adding Connection: close to our headers array, too; however I think there are advantages to persistent connections, and even better performance can be gained when used in conjunction with background tasks.)
I recognize we can also use batch requests to help improve performance, but those requests still rely on user interaction and result in a blocking call to the external resource (MailChimp). I've seen some requests in the MC Dashboard reported as taking 3-5 seconds to process, which for an e-commerce site is a potentially problematic amount of time to wait.
Therefore, any non-read requests to the API (PUT, POST, PATCH) should create or merge with a \GuzzleHttp\Pool instance, which in turn calls requestAsync(), thereby allowing the MC API PHP library to handle updating and creation of carts and orders without blocking user requests.
The text was updated successfully, but these errors were encountered:
According to MailChimp API Best Practices, they recommend that API calls be made as async background processes. This is to avoid times when the user might experience a long wait, as a response is expected from the MC API that might take a few seconds.
Currently this Guzzle HTTP library implementation uses request() exclusively, and as such all requests including Update and Create, are done synchronously, which means the end user will be required to wait for the response and its result. This leads to poor user experience, and in my case, I was seeing GuzzleHTTP reporting open connections of 15 seconds to the API. (This might be fixable just by adding
Connection: close
to ourheaders
array, too; however I think there are advantages to persistent connections, and even better performance can be gained when used in conjunction with background tasks.)I recognize we can also use batch requests to help improve performance, but those requests still rely on user interaction and result in a blocking call to the external resource (MailChimp). I've seen some requests in the MC Dashboard reported as taking 3-5 seconds to process, which for an e-commerce site is a potentially problematic amount of time to wait.
Therefore, any non-read requests to the API (PUT, POST, PATCH) should create or merge with a \GuzzleHttp\Pool instance, which in turn calls requestAsync(), thereby allowing the MC API PHP library to handle updating and creation of carts and orders without blocking user requests.
The text was updated successfully, but these errors were encountered: