Jump to content

The ultimate community for Ruby on Rails developers.


Thread vs Fiber for Request Scope

Threads Fiber Rails Ruby

  • Please log in to reply
1 reply to this topic

#1 snowleopard



  • Members
  • 2 posts

Posted 27 May 2014 - 05:54 PM



I need to put a value in a request scope so that it is generated and consumed within the request itself. 

There are two places I can think of putting that value in: ThreadLocal or FiberLocal.

To me it seems that two requests can never be served in same fiber/thread at the same time. Hence if I have a value that I want to put in request scope, either one should be fine. Is my explanation correct ?

#2 Ohm



  • Moderators
  • 507 posts
  • LocationCopenhagen

Posted 27 May 2014 - 08:41 PM

I'm not sure what you mean by "request scope", but it's correct that no two requests can be served at the same time.


Relevant xkcd:


Blog: http://ohm.sh | Twitter: @madsohm | Work: Lokalebasen.dk

Also tagged with one or more of these keywords: Threads, Fiber, Rails, Ruby

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users