It's possible to use two different fronted API endpoints. The benefit of using two endpoints is that downtime will be reduced even further and requests will be even faster.
Frontend API endpoints
There are a few technical differences between the two frontend API endpoints:
This endpoint is equipped with a real-time failover load balancer that automatically falls back on another data center in case of issues at one data center. This extra step in the network may increase the latency of requests.
Via this endpoint, the client connects directly with the closest data center and lowers the latency of requests. If there are problems at a data center, for example, hardware failure, traffic is automatically redirected to a different data center. Because this redirect is based on DNS, there may be a short interruption.
Setting up the failover
We advise using 'gateway.tweakwisenavigator.net' as the primary endpoint and setting up a failover to 'gateway.tweakwisenavigator.com'. The networks of both of these endpoints are completely separated, so we offer an extremely high uptime. We advise setting up the following mechanism:
- A customer sends a request to the primary endpoint. If it returns a network error, you try again using the secondary endpoint.
- If the primary endpoint remains unavailable, the secondary endpoint is used for 5 minutes.
- After 5 minutes, the primary endpoint is attempted again. If it's available, it will continue to be used. If not, the secondary endpoint is used for 5 more minutes.
- If there is ever a situation in which the secondary endpoint is unavailable, the primary endpoint will be attempted again.
Want to view an example in PHP? https://github.com/EmicoEcommerce/Magento2Tweakwise/pull/139/files
If you'd rather use one endpoint, we advise using 'gateway.tweakwisenavigator.com' instead of 'gateway.tweakwisenavigator.net'. This makes you less dependent on any DNS delay.