Open source deploy

I currently have the personal plan because my app is in a development state and I have no customers yet… but the performance is getting pretty bad… I have to wait for 5-7 seconds for every server call and that’s bothering me during debugging. Now I read about the open source option to host it on your own server… does anyone have experience with that? It would be great to bring back that waiting time to 1-2 secs max… I have no problem to start paying for a business plan as soon as I have some customers but not in advance :slight_smile:

If you haven’t done so already, search this forum for “performance”. You may find a solution that does not require your own server.

Did you find anything helpful following p.colbert’s suggestion?

Are you already knowledgeable about checking page speed in a browser - with the tools in Chrome, Firefox etc?

I already did a lot of the suggested things. I am caching my data and trying to limit the server and database calls. But the thing is that every server call already takes about 4s even if I do not do anything.

For example, I put a button on the homepage that prints the current datetime (with the blueish line) and immediately calls a server function that also prints the current datetime (with the orange line)… this shows that even without doing anything on the server side I have to wait around 5 seconds just to connect to the server code… this is way too long. Now it also shows that the client and server have different timezones so I guess this might be part of the answer.

Note that I am using the beta version of Python3.10 standard packages so maybe this delay will be removed once this reaches production?


Not discounting any delays you’re seeing, but you can’t compare client and server times. There’s no reason to expect that the clocks on both machines are synchronized.

For a better measurement of the delay in calling a server function, do the print on the client both before and after the server function is called. Then on the server itself you can do prints to gauge how long individual parts of the server function are taking. Or call a server function that does nothing to isolate just the round-trip delay.

For example, when I do the prints on the client and call a server function that does nothing, here are my results (the client being in Ohio):

2022-09-27 12:24:03.546000
2022-09-27 12:24:04.304000

Switching to the Python beta runtime, the first call seems to have a large delay, but after that it goes back to normal.

If you are using the Python beta runtime, you might be importing some custom packages. Those imports have to complete for every server call, so look into timing the imports, too, and identifying the ones that are taking up a lot of time. Those can be moved into just the functions that use them, rather than having them done for every server call.


Thanks @jshaffstall I didn’t know about the packages being reloaded between all server calls. That is probably the delay that I have right now. I will look into that.

1 Like

I wrote a lazy loader decorator a while ago, it might not be the best solution for what you are trying to do, but you could drop it in and see if it makes a noticeable difference.

I’ll also just add this reference, as it seems harder to find with the forum search than it should be:

Thanks for all suggestions… I moved all the imports of ‘heavy’ packages to a digital ocean server which is always running and removed the imports from the client and server side of Anvil… now things are at least 3x faster and the application runs smooth… I wish I had known this from the start!

1 Like