Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails development server, PDFKit and multithread

Tags:

ruby

thin

pdfkit

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.

like image 758
Rafa de Castro Avatar asked Apr 10 '12 22:04

Rafa de Castro


1 Answers

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
like image 119
Michael Slade Avatar answered Nov 02 '22 23:11

Michael Slade