App runs slow when multiple users accessing


Similar to the topic discussed in [App runs slow when multiple users accessing simultaneously], my app is being used by 20 people.

I am facing an issue where the response speed of my program gradually slows down after approximately 5 days of continuous usage. Clicking a button takes about 1-3 seconds. However, upon restarting the program, the response time significantly improves to 10 ms.

Is there any suggestion to me?
anyone, help…

Knowing nothing specific about your app, my first guess would be that you have some kind of memory leak or something. I’m not sure if anyone can provide any meaningful tips without knowing more about your app and its code.

For general advice, try profiling your app’s memory usage to see if you can gain insight into what may be contributing to the digital clutter.

1 Like

i think there are nothing about code, i try to use below code:

import streamlit as st'sssss',['1','2'])
if a=='1':

Then i use siege to test, when the concurrence up to 2, page’s response is slower than 1.
if i set the concurrence to 10 or more, the response time will be long, >5 seconds.

I run my streamlit on a windows 2022 server, i think its CPU and Memory is enough.

Never tried on linux.

thanks for reply but i still don’t know the problem.

I ran your code in a Windows 10 computer and then opened > 15 sessions in the same computer without experiencing any noticeable delays. So, if you see a lack of responsiveness when connecting from other computers, the issue must be network latency. How the number of sessions is related to network latency, I don’t know.

I tested manually, not with siege.

thanks for your reply agian, i guess this issue will only happend when multiple computers connect to the sever. I think my network it good, i even try it under local network. I only know little about the network, but i try to use nginx to proxy my app, i run multiple on different ports to avoid above problem. But there are some new problems…Hard to solve.
Here is my code of nginx.conf:

worker_processes  1;

events {
    worker_connections  1024;

http {
    upstream streamlit_servers {

    server {
        listen 8888;
        server_name localhost;

        location / {
            proxy_pass http://streamlit_servers;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "Upgrade";
            proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;

@WMKTT1 could you please let us know what version of streamlit are you running and if you tried to turn-off fast reruns?

Hi TomJohn:
I use the newest streamlit, I tried to test a simple script again yesterday using seige and Selenium. I found that when I used “seige -c 4”, which means 4 concurrent connections, there was a noticeable delay when clicking on “”, but it was not as obvious when using “-c 2”. However, the experience was slightly better when using Selenium. Now I use nginx as a reverse proxy, which has solved the problem. Please forgive me if I have any misunderstandings about streamlit due to my limited knowledge. However, I still want to know, theoretically, how many people can click at the same time if I only use “streamlit run”, where “.py” is a very simple script? The loading issue I encountered before was when about 12 people clicked at the same time.

I don’t think there is a theoretical limit. IIRC you the issue you found was slowness, not a limit. There is a practical limit depending on the system resources available to the application.