I'm not familiar with Ruby, so this is just some general information. The Racket web server already supports concurrency with its built-in green threads, so handling one request won't block the concurrent handling of another. (Not all languages' built-in web servers do this; I don't know about Ruby in particular).
There isn't built-in support for parallelism, i.e. for taking advantage of multiple processor cores. This isn't built in, and I don't personally need this (my server only has two cores, and it runs a database and other processes in addition to Racket). However, it is probably possible to recreate the architecture you describe. Essentially you would be running multiple instances of your application behind a load-balancer. If you want to use nginx as a load balancer, that's out of the equation; implementing a load-balancer in Racket would certainly be possible but probably more work. Extra-linguistically, you could just create a few systemd services or similar to run several totally separate Racket instances. Within Racket, you would want to build on "places." You can have N worker places running N instances of your application on N OS-level threads, plus a master place to control them. A mechanism for gracefully stopping the Racket web server is built in (see serve/launch/wait <https://docs.racket-lang.org/web-server-internal/web-server.html#(def._((lib._web-server%2Fservlet-dispatch..rkt)._serve%2Flaunch%2Fwait))>). Reloading isn't built in, but I've heard good things about the "reloadable" package (https://pkgs.racket-lang.org/package/reloadable), which should let you implement it if needed. While I only run one instance of our application, I do use places to redirect HTTP to HTTPS. One caveat is that all of this assumes that, if you are using continuations at all, you are using serializable continuations with `#lang web-server`. Making places work well with native continuations would probably be a lot of work, and it would probably be better to build that functionality into the Racket web server than to try to fake it as a client. -Philip On Fri, Nov 23, 2018 at 3:46 PM Brian Adkins <lojicdot...@gmail.com> wrote: > I'm porting a web application from Ruby/Rails to Racket, and I'd like > something to manage the Racket server processes. > > In the Ruby world, I'm currently using Unicorn ( > https://en.wikipedia.org/wiki/Unicorn_(web_server) ) prior to that I used > Nginx Passenger ( https://en.wikipedia.org/wiki/Phusion_Passenger ), etc. > Another popular Ruby app server is Puma ( > https://en.wikipedia.org/wiki/Puma_(web_server) ) > > I'll use nginx as the front end web server, and it will proxy to the > application server. In a nutshell, for Unicorn, I configure the location of > the Rails app, configure how many processes I want, and Unicorn will spin > up that number of Rails processes and handle routing requests from nginx to > each of the Rails processes in some fashion. If a Rails process exists > abnormally, it will spin up another one to replace it. To deploy a new > version of my app, I can send a signal to the Unicorn master process to > *gracefully* restart all the processes i.e. it waits for the current > request to finish, and then kills the process and spins up a new one using > the new version of the app. > > Are there similar application servers available for Racket? Alternatively, > if not, and you have long running applications in Racket, what are you > using to manage them? > > Thanks, > Brian > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.