Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 15:40
    MSP-Greg labeled #2885
  • 15:40
    MSP-Greg labeled #2885
  • 15:40
    MSP-Greg labeled #2885
  • 15:40
    MSP-Greg opened #2885
  • May 26 22:50
    vzajkov synchronize #2770
  • May 26 22:48
    vzajkov synchronize #2770
  • May 26 19:36
    eregon commented #2883
  • May 25 08:22
    ernsheong commented #2876
  • May 25 04:11
    ernsheong commented #2876
  • May 25 04:10
    ernsheong commented #2876
  • May 24 22:51
    nateberkopec commented #2875
  • May 24 22:51
    nateberkopec labeled #2868
  • May 24 22:50
    nateberkopec labeled #2884
  • May 24 22:50
    nateberkopec labeled #2884
  • May 24 22:50
    nateberkopec labeled #2884
  • May 24 22:50
    nateberkopec labeled #2884
  • May 24 22:50
    nateberkopec labeled #2833
  • May 24 22:50
    nateberkopec unlabeled #2833
  • May 24 22:50
    nateberkopec commented #2876
  • May 24 17:59
    alanhala commented #2876
raelik
@raelik
@likelazyeyes I would start looking for other culprits as to why your app is slow.
Dave Allie
@daveallie
Hey guys, I was just wondering if anyone has any idea as to when the next puma version is coming? Would really like to see the fix for #1002 released :D
Mike Pastore
@mwpastore
@daveallie You can always use master! Or even just the 46416cb49ed2f16614f019cee969bb8f5d0a6146 commit, which includes this fix
danilogarcia024
@danilogarcia024
Someone know where to find a tutorial for deploying some apps in the same server with different sub-uri, in Puma?
Mike Pastore
@mwpastore
@danilogarcia024 You’ll want to implement that in Rack, either nesting apps as middleware or using something like Rack::URLMap to build a routing tree. If that’s not an option you’ll likely end up needing to maintain multiple Puma processes with some kind of reverse proxy / request router in front of them
Sam Pierson
@sampierson
Hello. I have a Rails initializer that contains some code that I only want to run when we are running in server mode (not console or test). Than can be done if you boot with rails server as Rails::Server is only defined when that command is run. However we use the puma binary in production, Rails::Server is not defined and Puma::Server is always defined. Is there a way I can detect that I am running inside a puma server?
danilogarcia024
@danilogarcia024
Thanks @mwpastore that is the solution.
Mike Pastore
@mwpastore
:+1:
Ryan Strandt
@ryanstrandt
I am trying to force_ssl with puma and am getting
Puma::HttpParserError: Invalid HTTP format, parsing fails
don't know how to deploy to production?
Yusuke Sangenya
@genya0407
Hello. Does anyone know how to auto-reload classes when code changed?
In my current environment, puma becomes silent (returns no response) when I modify code while puma is up.
Of course, when I restart puma manually, it works correctly.
Nate Berkopec
@nateberkopec
@genya0407 Rails app?
Kimmo Lehto
@kke
where do i put something like "Starting server version #{VERSION}" so it would only show up once when starting puma and not for every worker?
aaand where's the changelog by the way? trying to find what's new in 3.7
oh it's called History.md
raelik
@raelik
@kke You'd use a before_fork block in the puma config.rb file.
Uwe Kubosch
@donv
Hi all! When developing a Rails 5 application, is there any point in having multiple workers in development mode? How are code changes handled for each worker? How do I best adjust the number of workers depending on environment (development/test/qa/production) ?
Marion Duprey
@TiteiKo

Hey folks, is it normal (but I guess not) that even though puma says:

Puma starting in cluster mode...
* Version 3.9.1 (ruby 2.3.4-p301), codename: Private Caller
* Min threads: 1, max threads: 3
* Environment: development
* Process workers: 2
* Phased restart available
* Listening on tcp://0.0.0.0:9295

I have the 2 clusters with 8 threads each...

raelik
@raelik
@TiteiKo Well, I believe ruby has an internal timer thread, and if your rack app spins up it's own background thread, that would add up to 8 threads.
I don't think Puma spins up any additional threads, but I could be wrong and that may be accounting for the difference.
I run my Puma servers on jRuby, so I see many more threads than that.
Dominic Tootell
@tootedom_twitter
Hi there. This is going to sound like a completely noob question. We are wishing to use logstash http input. This input starts a puma server for you. Locally (macbook) this puma webserver is processing 8k requests a second. However, as soon as we put this on an AWS linux instance (bigger boxes), the rps is 90 requests a second (c4.8xl even only 90rps). Is there some configuration somewhere, that needs to be changed on a linux server for it to be performant on a linux instance (have noticed the same issue on vagrant centos, and ubuntu vms).
Dominic Tootell
@tootedom_twitter
I should mention that logstash http input is using 2.16.0 of puma
Olle Jonsson
@olleolleolle

Eh, hi! I got interested in adding a low_level_error_handler to my app, as I read about it in Sentry's docs. My app is started using the Rack::Server.new way of saying it. Here's the invocation used.

server = Rack::Server.new(
  config: File.join('..', 'server/config.ru'),
  server: 'puma',

  Port: 22000,
  Silent: true
)

Is there a way to add a low_level_error_handler at this level?

Source: https://docs.sentry.io/clients/ruby/integrations/puma/

Michael Graf
@m-graf
Hey all, If I'm understanding correctly puma has no default timeout, and should only be explicitly set under config/puma.rb if we want to have a shorter timeout than infinity ?
Nate Berkopec
@nateberkopec
@m-graf No, Puma doesn't have the kind of timeout you're looking for. You need the rack-timeout gem.
Cassidy K
@cassidycodes
Hey All, I know it's a long weekend in the US, but hoping I can get a reply here. I have puma in my gemfile, and I'm using Mina (similar to capistrano) to handle deployment. We're keeping 5 releases on the server. Every 6th release, puma fails to restart and says that it can't find the puma executable. When this happens, it's looking for the executable in the most-recently-deleted release. It's like when Puma daemonizes, it links itself to the executable in the releases path, rather than the current path. I've tried this both using an init.d script. I've also set the directory in my config file, to no avail. Any help here would be greatly appreciated.
It's worth noting that this behaviour is new since we upgraded from 2.10.2 to 3.10.0.
Cassidy K
@cassidycodes
Strangely, when I took a closer look at the error when I was restarting the app, it said it couldn't load the puma binary, but it was referencing a releases directory that still existed.
Cassidy K
@cassidycodes
Just to clarify, when I was using init.d to restart the app, it was referencing a directory that still existed. When I was starting the app on my own with pumactl, it would work 5 times then fail on the 6th when the directory had been deleted.
Marco Colli
@collimarco_twitter
Hello! Currently I use HAProxy to load balance 10 servers. Each server has both nginx (as a reverse proxy) and Puma (as application server). I wonder if nginx is required, or if it would be more performant to use Puma directly (behind HAProxy). The reasons why I have nginx are: 1. serve static assets (like css, js, etc.) faster 2. protect Puma from slow clients
Cameron Seebach
@cseebach-lh
@collimarco_twitter I think you'd want to keep nginx for reason 1. Otherwise, your framework will need to handle those. I'm fairly confident that Rails is much slower at this, and plus with Nginx it's a config file change to start gzipping assets or doing other stuff with them if needed. I'm not convinced it offers any benefits for reason 2, but the best way to know for sure is to run your own test with slow clients.
Cameron Seebach
@cseebach-lh
@collimarco_twitter If you're okay with HAProxy helping out with slow clients, there appears to be some configuration you can do there: https://www.haproxy.com/blog/what-is-a-slow-post-attack-and-how-turn-haproxy-into-your-first-line-of-defense/
Cameron Seebach
@cseebach-lh
@evanphx Is there a channel for puma-dev issues? I'm experiencing problems that are almost certainly related to the configuration of my machine and not to puma-dev, so I'm reluctant to file an issue on GitHub
Brian Purgert
@BrianPurgert
Does puma create a seperate process for each request,
raelik
@raelik
@BrianPurgert No, it has a set number of threads and/or workers that field the requests
Chris
@ipatch

@raelik just curious but what advantage is there to setting the worker # to something other than 0

when I deploy a rails app using cap & puma I have the below line in my deploy.rb

set :puma_workers,    0
Brian Purgert
@BrianPurgert
@raelik
raelik
@raelik
@ipatch If you're using jRuby, there isn't one, and in fact, you can't.
If you're using MRI, you can better utilize multiple cores, since MRI doesn't have truly native threads
But, since ruby 1.9 (2.0 maybe?), the I/O is handled internally using native threads, so the typical use cases of threads that wait on I/O will tend to run concurrently even with the GIL locking the green threads.
So I don't think on modern ruby versions there's much use for having multiple workers.
I think if you're doing something more CPU intensive in your Rack app, you may want multiple workers.
Chris
@ipatch
@raelik definitely not using jRuby, all my rails apps are currenty using rvm ruby 2.3.1 love song
raelik
@raelik
@ipatch Right, so long as your rails apps aren't servicing long-running requests, I think just having a single worker with your threads set appropriately is enough.
Chris
@ipatch
@raelik by single worker you mean cap / puma begins its index at 0 and not 1 ?
raelik
@raelik
But if you start doing odd things (like say... handling persistent websocket requests), you shouldn't need to use the worker model
Technically, in the case of setting workers, 0 and 1 are effectively the same
0 means you're disabling the worker model entirely.