# Unicorn Server questions

**URL:** <https://www.ruby-forum.com/t/unicorn-server-questions/180120>\
**Category:** Ruby\
**Created:** [December 12, 2009, 4:07am UTC](https://www.ruby-forum.com/t/unicorn-server-questions/180120 "2009-12-12T04:07:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![beev](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/b38774/32.png) [@beev](https://www.ruby-forum.com/u/beev)\
**Post date:** [December 12, 2009, 4:07am UTC](https://www.ruby-forum.com/t/unicorn-server-questions/180120/1 "2009-12-12T04:07:28Z")

</div>

First is regarding the the “listen” configuration option. Why is this  
option important? What can I do once a worker is set up to listen on a  
port? I do not really see the need of this unless…

What I am really trying to do is check each worker processes backlog and  
if it exceeds some arbitrary number I can tell my load balancer to mark  
that machine down. Is this even possible? From within in Rails (or  
anyway) is there a way for me to check on the current state of Unicorn?

Can you please point me in the right direction as I am having problems  
finding any good information on these topics.

Thanks!!!

---

<div class="post-metadata">

**Author:** ![beev](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/b38774/32.png) [@beev](https://www.ruby-forum.com/u/beev)\
**Post date:** [December 12, 2009, 8:11am UTC](https://www.ruby-forum.com/t/unicorn-server-questions/180120/2 "2009-12-12T08:11:39Z")

</div>

Mr Balla [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> First is regarding the the “listen” configuration option. Why is this  
> option important? What can I do once a worker is set up to listen on a  
> port? I do not really see the need of this unless…

Hi,

You mean a per-worker listen for workers (inside after\_fork hooks)?  
It’s entirely optional in that case but may be useful for debugging or  
migrating from another server. Normally you start a listen socket in  
the master process and that is automatically shared when it forks off  
workers.

By default, if you specify any listen, it will listen on TCP port 8080.

> What I am really trying to do is check each worker processes backlog and  
> if it exceeds some arbitrary number I can tell my load balancer to mark  
> that machine down. Is this even possible? From within in Rails (or  
> anyway) is there a way for me to check on the current state of Unicorn?

The listen backlog is managed entirely by the kernel. There may be  
instrumentation packages for your kernel that make it possible to  
inspect the backlog, but off the top of my head I don’t know of any (nor  
have I ever needed it).

Keep in mind that the exact size of the backlog is rarely exactly the  
value you specified.

> Can you please point me in the right direction as I am having problems  
> finding any good information on these topics.

A good chunk of Unicorn configuration options map directly to the  
underlying UNIX system calls, so reading UNIX/Linux manpages is a good  
way to understand Unicorn:

The following manpages are a good start:

socket(7), tcp(7), unix(7) - overall concepts

listen(2), fork(2), setsockopt(2), socket(2), … actual syscalls
