Thin vs WEBrick: lesson learned

1,486 views
Skip to first unread message

Matthew Dundas

unread,
Dec 9, 2013, 10:02:52 AM12/9/13
to spree...@googlegroups.com

The API in our Testing environment stopped working last wk.
It was stressful and a client was upset.  After a looooooot of troubleshooting i discovered the problem was b/c we had recently switched from WEBrick to Thin to evaluate its performance benefits.

It turns out Thin doesn't return Content-Length in the HTTP Response ( which probably violates the HTTP 1.1 spec ).  Browsers don't care.  But be careful, consumers of your API may care.  All of our API requests flow through Apigee.
( i'd highly recommend them for added security features, monitoring etc.. ).   Apigee would barf.  But only sometimes.

Anyway.  Lesson learned.  Thin will not be part our landscape.
No one enjoys these episodes, so i thought i'd share....
-matt

Andrew Hooker

unread,
Dec 9, 2013, 10:34:32 AM12/9/13
to spree...@googlegroups.com
Matthew,

It looks like this was a decision Thin made quite a while ago (https://github.com/macournoyer/thin/commit/0db8ddb906c2e4c9d14bd02dcb8b4470c1f16cfb). If you google rails content-length you’ll find a lot of solutions for how to fix this… if it’s happening from Spree core code, feel free to file an issue on https://github.com/spree/spree 

I’d seriously recommend not using WEBrick for anything other than local development. http://stackoverflow.com/posts/10859687/revisions provides a fairly good explanation of some of the issues with running WEBrick in production. 
---
Andrew Hooker
Lead Support Engineer
Spree Commerce, Inc.

ma...@katori.com

unread,
Dec 9, 2013, 10:37:52 AM12/9/13
to spree...@googlegroups.com
Our production site is on Heroku.  I just need something decent for the Testing environment.

Nate Lowrie

unread,
Dec 9, 2013, 1:16:01 PM12/9/13
to spree...@googlegroups.com
Why wouldn't you just use passenger with nginx? That's about the easiest combo to setup.

ma...@katori.com

unread,
Dec 9, 2013, 5:51:43 PM12/9/13
to spree...@googlegroups.com
Thx Nate i'll look into it.

Ryan Bigg

unread,
Dec 11, 2013, 12:05:11 AM12/11/13
to spree...@googlegroups.com
Very interesting problem... I would suggest using either Unicorn or Puma on Heroku.


On Tue, Dec 10, 2013 at 9:51 AM, <ma...@katori.com> wrote:
Thx Nate i'll look into it.



--

Ryan Bigg
Community Manager
Spree Commerce, Inc.

Matthew Dundas

unread,
Dec 11, 2013, 7:08:10 AM12/11/13
to spree...@googlegroups.com
Yes, i'm not sure how popular Apigee is in the Spree community.... but i point it out b/c other clients may rely on Content-Length being there...
Reply all
Reply to author
Forward
0 new messages