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.
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.
hi,
i think there are nothing about code, i try to use below code:
import streamlit as st
a=st.radio('sssss',['1','2'])
if a=='1':
st.write('1')
else:
st.write('2')
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.
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 app.py 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 192.168.1.5:8880;
server 192.168.1.5:8881;
server 192.168.1.5:8882;
server 192.168.1.5:8883;
server 192.168.1.5:8884;
server 192.168.1.5:8885;
server 192.168.1.5:8886;
server 192.168.1.5:8887;
}
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;
}
}
}
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 “st.radio”, 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 simple.py”, 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.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.