Root cause of running speed difference between in the local and in the Streamlit Cloud

Hi everyone,

I’ve developed an app but I see that it works in local slowly. I guess, root cause of this problem is the code runs after every single action in the app throughly. I think that it is a common case for streamliters :slight_smile: (You know, there is a “running…” text in the upper right corner of the screen and it makes you wait for a while.). Anyway, I’ve noticed that when I deploy my app in the Streamlit Cloud, the speed issue is gone. Why did I face this problem and how can I fix it in my local?

Here is my app and its source code:

Thanks in advance for your responses.

1 Like

I have the similar problem, it could be great if we could learn why it happens.

Any ideas or experiences? I really love using streamlit, but I’m tired of facing this issue and it gets me down.

For instance, I’m filtering my dataset via selectboxes but I have to wait for a while after making each selectbox selection.

Is there a difference between local and cloud? Because I realize that there is a performance difference between the same projects running in two different platforms (local and cloud). How can I ensure high app performance in my local as in the cloud?

st.cache is a solution that improves app performance but it can’t prevent the rerun of other streamlit components.

By the way, the main issue is not “re-run”. Why does the same code run and respond in the cloud quicker? If there is a default limitation in the local, how can I increase my resources?

@randyzwitch @andfanilo sorry for disturbing you. Do you have any advice for me?

What are the specs of your local computer and what operating system?

The specs of my computer are:
Processor: Intel(R) Core™ İ5-6200U CPU @ 2.30GHz 2.40 GHz
System type: 64-bit operating system, x64-based processor
Windows 10 Enterprise

For instance, I need to wait about 4 seconds after every single selection for the ‘running’ text to disappear in the simple app above. (After every selection, this app filters the selected dataframe.) Sometimes when I make selections of all fields without waiting, all of a sudden the page refreshes itself and I have to make my choices again :frowning:

We experienced the same issue, although we tried to run another streamlit app on a much more stronger machine. (32 CPU, 128 GB RAM, Ubuntu 18.04)

By the way, there is no resource limitation for us, if we decide to deploy a streamlit app on-prem. What would you recommend? What are the recommended system requirements for streamliters who run their apps on local?

Thanks for your interest and answer.

Best regards,

Maybe it would help to put all your select boxes into a st.form. In this way you could make all your selections and apply them at once which would improve the user experience.

In that case, I’m not sure what to even suggest. Your machine is likely 2-4x the resources of the container that is running the Streamlit Cloud app. But then you say you tried on Ubuntu, which feels like it eliminating being an operating system issue.

So we’ve eliminated (?) operating system, resources and code (since it’s the same code)…not sure what else to say other than @thunderbug1 's suggestion of evaluating how you are processing the inputs. Is there code you can share that demonstrates the issue?