Forums

is that still valid ?

A pythonanywhere staff said in 2013 that "Unfortunately right now we don't enable threads, though Web Developer accounts get multiple worker processes per domain (free and Hacker accounts don't) "

Is this rule stiil same ?

is it possible to access web2py application by more than 1 user simultaneously ?

I am using free account

We still don't support threads, but that doesn't directly impact your ability to have a web2py site that is accessed by multiple people concurrently. When someone browsers a website, their browser makes a request to the server, which returns a page, and then they make another request, and another page comes back, and so on. So even if a thousand people were viewing a site, so long as the site responded quickly to each request, it could handle all of them with one process/thread.

Think of it this way -- if your code takes 0.2 seconds to respond to a request, then you can handle five requests per second with one process. If it takes 0.1s, you can handle ten requests/second -- but if it takes 0.5s, then you can only handle two requests/second.

If more requests per second come in than your site can handle, then they'll be put into a queue and processed in the order they came in -- so brief "spikes" in usage are not normally a problem, but sustained periods of lots of requests can lead to pages not loading.

Things get a bit more complicated with paid accounts; a free account has just one process handling all of its requests, whereas a paid account has at least two -- exactly how many depends on the details of the account. As you would expect, a website with two processes can handle twice as many requests as one with just one, and website with two can handle three times as many, and so on.

Thanks for quick response as i understood what you told that you service isnot good for hard process such as image process or video process.if we talk on static pages the durations 0.2 seconds or less than are reasonable so then your paid services (web developer and others) are also not suitable for powerful processes when thousand people try to reach webapp.

If i miss something please let me know

In general, and not just on PythonAnywhere, doing expensive operations during a web request is not a good idea. If you need to do something expensive as a result of a user action, you should use a queue of some sort so you can do the processing outside of the web app and then let the user know when the process is done.

You can also add more workers to handle additional load.

You are right about doing hard works should be done on other platform such as VPS etc but while doing this hard process, users have to be informed whats going on his/her request so the system will use javascipt ajax request or sockets for passing data about progress to clint side .The system will use a web worker (as your term) to hangle this javascipt ajax request to inform user so that blocks other users to reach webapp.

Thanks in Advance

It doesn't really block the worker, because sending a "it's not ready yet", or "ok, it's ready" response does not take very long, so other visitors can have their requests handled in between.