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.