multithreading - Approach to serve multiple users concurrently with dancer -


for reason not find answer question below, because obvious.

during experiments perl dancer, added route, sleeps 10 seconds , returns something. did in order simulate long-running operation. noticed, during these 10 seconds, dancer not serve other request. understand because dancer single-threaded.

now single-threaded approach not suitable mildly demanding applications. believe there must nuber of established solutions. don't seem know right search strings google for.

to make things clear: don't mind, when reqest initialted long running operation itself gets blocked. want other requests sill being served.

could please enlight me in terms of

  • how webservers traditionally handle long-running operations, without blocking other requests ?
  • will there threads/processes each session, or can threads/processes spawned on-demand, in situations, know operation take long time
  • how session information preserved when going multi-threaded, i.e. when browser not talk same process?
  • any particulat recommendations concerning dancer (feel free recommend alternative dancer)

  • this depend on web server , underlying operating system - there answer on here in relation apache httpd here: what apache process model?

  • note 'out of box' dancer uses http::server::simple single threaded, however, not option. see https://metacpan.org/module/dancer::deployment range of dancer deployment options starting apache cgi provide concurrency web server. if working on *nix environments spawning detached process easy - , harder possible on win32 - may need send results client other mechanism http response (such stomp or websockets). approach spawn separate long running process dancer route, return lookup key client in route, , have client poll on route completion of process. maybe answer need web server in front of dancer can handle concurrent requests.

  • your browser store session information in cookie , dancer store corresponding session information on server , dancer match these up. doesn't answer third question except don't worry it.

  • if dancer supporting of needs except concurrency / long running process issue sounds reading on web server deployment options: https://metacpan.org/module/dancer::deployment might solve problems. note before if on *nix environment have more options in terms of perl based concurrent web servers confident problem can solved on windows. completed proof of concept of using iis + fastcgi.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -