Streamlit cloud vs local host

Hey, I have notice that when I run Streamlit locally it seem to work quite well but when I try to host the app on the cloud I have experienced a few issues. Once the browser opens my app take quite a while to render content to the screen and once it does if at all it runs extremely slow. With respect to the server side, It seems like the app keeps trying to rerun itself. Since everything is logged and displayed in the terminal I should only see logging of one event for each action. If anyone has any ideas please let me know. The following is a screen shot of what is happing each time i run the app on the cloud. Once again I only experience this while hosting via the cloud which i find to be rather peculiar.

Hi @Jason_Harper,

Thanks for posting!

Can you share the link to your app?

Caroline :balloon:

Hey @Caroline

Thank you so much for getting back to me, I really appreciate it. Unfortunately, the app is currently private because there is sensitive data that can’t be disclosed to the public but my company and I would be happy to work with someone to see if we could provide them some info to help them assist us. Please let me know if this is an option.

Hi @Jason_Harper,

Without looking at the app, I would recommend checking out this blog post on strategies to minimize memory usage. I would also recommend making sure that you’ve included a requirements.txt file that has all of the packages your app is using – if you’re missing packages, the loading process might take longer since the appropriate packages need to be identified and installed.

Best,

Caroline

Hey Caroline,

Thanks for these suggestions. The build process is not too slow. Rather, once the app is built and running, each operation (e.g. clicking a submission button) stalls. From our logging, we can see that the app keeps rerunning, even though nothing is happening in terms of app functionality. Sometimes the app will rerun as many as 20 times before the expected operation completes. Can high memory usage cause this problem? Or do you know of any other reason why this might happen? Moreover, what are the primary differences between hosting locally as oppose to hosting on the cloud when using Streamlit? I think this might help me near the problem down.

Hi @Jason_Harper,

The app shouldn’t be rerunning – again, happy to take a look to see if we can reproduce the behavior. High memory usage shouldn’t cause the app to rerun.

The differences between running a Streamlit app locally vs. deploying it aren’t unique to Streamlit – any time you deploy an app instead of running it locally, the environment that the app is being deployed in might end up being different from the local environment if you have different packages/versions of dependencies installed locally vs. in the container where the app is deployed.

Hope that helps clarify.

Best,

Caroline

Thank you so much @Caroline. This is certainly helpful, I will check that the envs are consistent as well as a few other things and I’ll then let you know how everything worked out once this is done.

1 Like