Rails development server, PDFKit and multithread
Asked Answered
P

1

6

I have a rails app that uses PDFKit to render pdf versions of webpages. I use Thin as a development server.

The problem is that when i'm in development mode. When I start my server with "bundle exec rails s" and I try to render any PDF the whole process gets deadlocked because when you render a PDF some extra resources like images and css are requested to the server and looks like there is a single thread.

How can I configure rails development server to run multiple worker threads?

Thanks a lot.

Phanotron answered 10/4, 2012 at 22:0 Comment(0)
E
11

The simplest solution I have found is unicorn.

gem install unicorn

Create a unicorn.conf:

worker_processes 3

And then to use it:

my_gem_tree/bin/unicorn_rails -c unicorn.conf
Emmett answered 10/4, 2012 at 22:37 Comment(1)
You can also do this with puma, which is the default web server in Rails 5.Weldon

© 2022 - 2024 — McMap. All rights reserved.