Webserver or backgroundworker for algo+streamlit

Hi.
If i add to my Algo
(which is doing calculations in a dataframe )
a module which streams that df on to webapp per streamlit …
… do i need to deploy it then as a webserver or as a backgroundworker.
would technically both be possible? How this is decided?
ThX

Hello @MirexTion!

If you are hosting a web app, you should deploy it as either Autoscale (Automatically scales up to how much resources you need, but not always on) or Reserved VM > Web Server (Does not scale to resource needs, but always on).

3 Likes

ok. also if 99 percent is in fact backgroundcalculations and only one page is streamed to the webapp? so should it first start the streamlit and then as subprocess the calculations? Because now i have streamlit as a subprocess but somehow this is really difficult to find the right setting for the deployments . it is deployed but the webapp is not streamed

Hi @MirexTion !
Try Autoscale first. If it fails, try Reserved VM with Background worker.

ok . thx. but in common. how is the rule for webserver vs background when you have multiple tasks in your code. even with db sending to webserver. do i choos webser and then the db doent work or do i choose webserver and then the db doent work. how i set it up thatboth work in one replit. for now i had a sequence from 1-7 and when 7 is reached it streams the resulting csv/df to streamlit . but also possible to import into the streamlitmodel the calculations of 1-7. so is it then a webserver or backgrounfd. which makes more sense or is even possible without blocking the other?

1 Like

3 things:

  1. I think I made a mistake in my post. I meant web server, not background worker.
  2. Try changing your deployment run command to streamlit run main.py under [deployment] in your .replit file `, and try deploying it as Reserved VM, web server.
  3. What database are you using?