How can I test the time it takes to load and render my application?

I experience once in a while that the applications I create get slow over time. It might be due to for example growing amounts of data, more users and deployment issues.

I would like to setup automated tests of the time it takes to initially load the page.

I sometimes use Locust for load testing. But my understanding is that it only measures the response time of the initial request. Not the web socket communication and rendering part.

I would like to to test the time it takes before the page is rendered and ready for the end user.

Furthermore I would like to setup some max limits and get notified when the time exceeds the limits.

I’m imagining I could test this using Pytest and run the tests automatically on a schedule.

But which tools would enable me to do measure the time it takes my application to be ready for use?

Hi @Marc,
I know this post is an old one, but I’m facing some performance issues with the apps that I’ve created.
I like to find a way to profile the app to find out the bottlenecks and also ways to address those bottlenecks and improve the performance.
I’ve been playing with Snakeviz, I still have hard time to pinpoint the areas let alone to improve the performance. If you’ve figure out how to improve the performance, I’ll appreciate it if you can share some tips here.
I expected that Panel would be able to handle real world load. As of now, I have only one active user in my app and the performance has been huge issue.

Hi @Mana ! Could you describe more the performance issues you’re encountering? And what you’ve tried to improve performance?

1 Like

Hi @maximlt

Sure. I’ve made a somehow involved app with Panel. Here’s a description of what it does:

  1. Through some selectors, user can retrieve the desired dataset from database. The backend/database is running well, so any issue with that is rolled out.
  2. The dataset contains 3D-geo-points with multiple dimensions for each point.
  3. Data will be plotted to a plan view plot with a map in the background, as well as some ground truth data.
  4. Through some filters, users can filter the dataset to desired rows which will reflected in the plan view plot.
  5. User can box-select some data points.
  6. A tabulator will show some statistics about the box-selected data points grouping them by a key.
  7. Also a set of timeseries of dimensions will be shown for the box selected points.
  8. User can manipulate points in multiple ways …

The performance issues:

  1. It takes long time to load the data, and sometimes it doesn’t even load the data.
  2. The busy indicator is spinning all the time, so it’s not possible to realize which state we are at.
  3. Sometimes the timeseries doesn’t show at all, I’m guessing it’s due to long delay for the request to being processed. I’ve notices TOKEN IS EXPIRED in the log.
  4. I’ve set up Admin Panel, but sometimes it just shows an empty black page. And it happens when I need it the most and something has taken long time.
  5. I’ve setup Snakeviz Profiler for panel serve, but when Admin panel is not showing I can’t see the result.

Another bottleneck that I’ve found is that as I’m using Pandas to manipulate data on the fly for the app, that brings its own shortcoming and limitation to the equation. For example, box-select just returns a set of boundaries, and then I am using Pandas to filter the data inside those boundaries. For a large dataset, that means a long delay. Is there any better way to maniplate data on the fly, after it’s retrieved from database?

I’ve already tried to make all the Pandas operation as efficient as possible using the vectorized operations and other ways that improves pandas operations. Still not happy with the performance.

I would like to know if there’s any way to improve the performance of holoviz (holoviews, panel, …) objects.

1 Like

Hi @Mana

Would it be possible to share a minimum, reproducible example? It will be really hard to find the cause without it.

1 Like

Hi @Marc , I really appreciate your attention to this matter. Unfortunately, I can’t make minimum reproducible example. The problem is that every feature works in isolation or in combination with few other feature, but when I put together an involved data app to run on large datasets it seems that it’s struggling to respond in reasonable time. Our data team has picked Panel for our tools and already couple of apps has been built, third one is coming soon. I hate to conclude that Panel is not handling real world situation.
Here’s how you can help here. If you were in my situation what would you do to profile, find bottlenecks and improve the performance? Is there any guidance on this? Any tip would be appreciated.

I usually litter print statements with

print("STARTING")
s = time.perf_counter()
# your function calls
e = time.perf_counter()
print("TOOK", e - s)

You can even be fancier/make it more convenient by writing a decorator.

If you’re rendering a bunch of data to browser, the bottleneck might be sending data to the browser so you might want to use rasterize/datashade.

Another idea is to cache what you reuse.
https://panel.holoviz.org/how_to/caching/index.html

The problem is that every feature works in isolation or in combination with few other feature, but when I put together an involved data app to run on large datasets it seems that it’s struggling to respond in reasonable time

Even if you provide minimal examples on each feature, it’ll help us get a better idea of what you’re encountering.

1 Like

@ahuang11 thanks for your tips.

I’ve been using panel serve --profiler snakeviz to profile different modules. I found and improved a slow module which helped improving the loading time. I still need to improve performance when user is interacting with app. Any tip on that?

Would rasterize/datashade improve the performance? I’m afraid that bring more element/processing to the equation and slowing it even further.

I’ll try caching to see if that helps.

Thanks again for the tips.

I still need to improve performance when user is interacting with app. Any tip on that?

Hard to say without any code.

Would rasterize/datashade improve the performance? I’m afraid that bring more element/processing to the equation and slowing it even further.

Depends on how big the data is; no harm in trying, it’s a flick of a switch if you’re using hvplot.
https://hvplot.holoviz.org/user_guide/Gridded_Data.html#rasterizing