Forum Academy Marketplace Showcase Pricing Features

External API performance based on server location

I need some advice regarding external APIs.

I need to use an external API to lookup data from an external database to check professional credentials of my users. Users enter their professional registration number and I run a lookup using the Bubble API connector.
All users of my app are in the UK, so will make the request to the Bubble app from the UK.
I understand the Bubble data centres are hosted in the US.

I can choose where I want to host the external database. Is it better from an API performance perspective to host the external database nearer the Bubble data centre (i.e in the US) or nearer to the Users (i.e in the UK)?

I am by no means an expert in this and I would actually say I know almost nothing about it, but I read two articles I found and it seems to be most important for the server to be nearest the end user.

Thanks @williamtisdale

I did a bunch of tests on the API performance. For anyone else that has this dilemma, I found the fastest load time by far for the end user was using ‘Make API request from browser’ and hosting the external database as close as possible to the user (i.e. the UK for me).

If not using the ‘Make request from browser’ feature (i.e. private requests), the fastest load time was hosting the external database near Bubble (i.e. the US).

1 Like

That makes sense. Note that by making an API request from the browser, you may be exposing credentials (API keys, etc) that you may not want to expose. Also, for anyone else that may attempt this, an overwhelming number of APIs won’t work in the browser (due to CORS).

Just a couple of things I thought would be worth pointing out :slightly_smiling_face:

Thanks @progressier. Yes the request I’m making is to a public database without an API key so I’m not concerned about exposing credentials.

Is the CORS issue related to the API endpoint or the browser? I wanted to establish whether some of my users will be experiencing issues if they are making requests from old browsers, different versions etc. or if the browser API requests works in one browser, CORS shouldn’t be an issue for the rest?

As long as it works in your browser, its should work for 99.9% of users. There may be a few obscure browsers that interpret CORS differently that I’m not aware of, but CORS is generally consistent across browsers. Basically, it all comes down to whether that particular API returns a response with a access-control-allow-origin: * header or not. If yes, it will work fine. If not, the browser will refuse to let you see the content of the response (that’s called an opaque response, for reference).

Not an expert, but here is my opinion-

I think instead of choosing server location based on bubble server location, you should decided based on the user i.e. UK in your case. Since now most api supports CDN functionality, that way they will cache the api response on the server so that will fast for your user to access data.

I feel since you are dealing with some sort of text, it does not matter that much where is your server location.

This topic was automatically closed after 70 days. New replies are no longer allowed.