Performance isuue

Hello,
I use the legacy Professionnal plan. When I access an application that I have developed, it takes a long time to start up. I have also created an API that allows me to download images stored in my Anvil database. When I download these images from an external application, it can take from 30 to 45 seconds. Any idea what could be causing this slowness? I have to say I’m a bit disappointed with the performance, despite Anvil’s fantastic features.
Thanks

There are a lot of possible causes for poor performance. Optimizing any web app involves looking at a bunch of different places. With the information you’ve given, it’s impossible to say where the issue might be.

Here are some common causes, but these are by no means exclusive:

  1. Putting images into image components via the properties panel instead of using images from Assets or data tables (this stores the image as a base64 string, and too many of those will slow down your app loading)

  2. Importing heavy weight libraries in the server. Some libraries take a long time for the import, and since they get imported with each server call, this can put a delay in everything. The only way to find these is to time the imports of the non-standard libraries you’re using.

  3. Too many server calls being made. Each server call incurs a network delay. Ideally you want only one server call that returns all the information you need for a given user action.

  4. Server calls in repeating panel row templates. Since these get run once per row in the repeating panel or data grid, this can be a big time sink.

If you do some searching in the forum on optimization, you’ll find other things to look for, too.

1 Like

…and measuring the impact. Intuition just doesn’t cut it in a system with caching, with multiple users, and with this many layers.

Anvil will give you a few time-measurements for free, if you look, e.g.,
image
But because there’s no telling in advance where the rest should go, you’ll have to rig those measurements yourself.

1 Like

Hello,
I read somewhere that some plans offer a non persistent server. If I understood correctly, this would slow down requests a lot. Is it possible that this is the case with the legacy Professional plan? I’m asking because before upgrading to the Business plan, I’d like to be sure that the persistent server of the Business plan can speed up the loading of my application. In my initial request, I forgot to mention that the application receives very few requests, which makes me think that maybe the server stops between requests. What do you think?
Thanks

Business plans do offer a persistent server, which can speed things up.

But! A persistent server only speeds certain things up (primarily the startup time for server calls). Before spending money on the upgrade, you should identify where your performance issues are, and optimize what you can.

After you’ve optimized your app, if you’re still having issues in the spots that a persistent server would help, then it makes sense to upgrade.

And to help me pinpoint the causes of slowdowns, could you give me an idea of how long it can take a server to start up?

That varies so much, depending on what you’re asking from the server, it’s only meaningful to measure your specific case instead.

I suggest:

  1. In your IDE, start your app in a new window.
  2. Immediately check the IDE window figures, as shown in my earlier screen shot.

Edit: You could compare this against startup of a new, virtually empty App, by creating a dead simple do-nothing App, and doing the same measurement.

Brilliant idea! That’s what I’m going to do test with an empty application. Thank you both for your helpful advice.

Thanks. Sorry to harp on measurement, here. It’s just that there are so many unknown variables, we can’t anticipate them all.

And to correct for them, guess what? They have to be measured.

Your mileage may vary. I had really slow access, for awhile. Turned out to be my Internet Service Provider. We were on what they called a Business Plan, which turned out to be in the megabit (not gigibit) speed range…

We changed providers.

1 Like