We’ve had a blast this weekend building a Streamlit app to simulate Coronavirus spread: https://corona-calculator.herokuapp.com
We’ve deployed it on Heroku, which was pretty straightforward (and aided by this blogpost https://gilberttanner.com/blog/deploying-your-streamlit-dashboard-with-heroku).
However, we’re now seeing decent traffic and I’m trying to understand whether simply increasing the size of the Heroku dyno is going to help reduce latency (which keeps spiking to >1s) or not. Is Streamlit spawning multiple processes behind the scenes or do we need to explicitly pursue a horizontal scaling strategy e.g. via Docker?
Any help much appreciated!
4 Likes
I’m having exactly the same problem. I created this app for COVID-19: https://covid-forecasting.herokuapp.com/ using Streamlit and I’m having that problem scaling it on Heroku. It’s my first app deployed and the high traffic is burning it. Any help?
Thanks!
Hey! Our solution in the end was just to vastly increase the resources available
Start by adding more Dynos of the same tier - horizontal scaling. If that doesn’t work and you’re persistently seeing out of memory issues, increase the performance of each Dynos. We’re now on Performance M Dynos with autoscaling to keep up with the demand.
We’ve asked Heroku for help to cover the costs - they’ve said yes but yet to see the credits hit my account.
Hope that helps,
Archy
2 Likes
Hi @archydeberker! Thanks for posting! Streamlit does not spawn multiple processes, so I would think horizontal scaling is a good solution here.
–matteo
I also ended up upgrading the Dynos, and is working!
I also had a problem with the sidebar and I had to delete it, do any one had the same problem? It disappeared for some users and duplicated/triplicated for others. I don’t know if it was due to Heroku or Streamlit
Thanks anyone!
I once had a problem with session management in the sidebar - users could see each others’ actions. We resolved that by upgrading Streamlit. See https://github.com/streamlit/streamlit/pull/1015 and its resolution in https://github.com/streamlit/streamlit/pull/1015/files. It’s not quite what you’re describing, but worth checking you have a recent version running.
Hope that helps. If not feel free to share your code and I’d be happy to take a look. I doubt it’s a Heroku issue.
Actually I just checked your app and you’re running Streamlit v0.52.2
, which is old - we fixed our issues by upgrading to 0.56
so that might do it
1 Like
Hello everyone !
@myrthings just chiming in to echo @archydeberker’s suggestion, Streamlit is evolving at a very fast cadence, so for example the sidebar cross-talk should be fixed by upgrading your version of Streamlit. Could you give it a try ?
Also I’d like to thank both of you for your feedback on Heroku deployment ! It’s nice to see Streamlit dashboards of this quality in the nature don’t hesitate to come back here if you have other issues !
1 Like
Thanks for everything @andfanilo and @archydeberker, it’s been really useful !
I’ve upgraded the version and put again the sidebar!
I’m having a new issue though, in version 52.2 the selectbox search wasn’t case sensitive, but with 57.2 it is. Is there a way to change it? I haven’t seen anything in the docs
Thanks again! I’m in love with streamlit!
1 Like
@myrthings Looks like case sensitivity in the selectbox search should be fixed with the next release as it’s been merged into develop via https://github.com/streamlit/streamlit/pull/1269
In the meantime, feel free to use a nightly build to get this functionality now https://pypi.org/project/streamlit-nightly/#history
1 Like