Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce locking in VariableTableManager#initObjectId #1400

Closed
nirvdrum opened this issue Jan 13, 2014 · 1 comment
Closed

Reduce locking in VariableTableManager#initObjectId #1400

nirvdrum opened this issue Jan 13, 2014 · 1 comment
Milestone

Comments

@nirvdrum
Copy link
Contributor

@nirvdrum nirvdrum commented Jan 13, 2014

While running a production Rails 3.2 app in JRuby 1.7.10 with 100 concurrent requests I saw a lot of blocked threads waiting on the lock in VariableTableManager#initObjectId. It appears that Rails makes excessive use of object_id and this seems to be hurting concurrency.

I'm seeing the source of contention in a couple places. One that pops up a fair bit is ActionView's template cache:

https://github.com/rails/rails/blob/v3.2.16/actionpack/lib/action_view/template/resolver.rb#L70-L90

Another seems to be in the Rails router when generating routes for the path/url helper methods. It seems to be in the journey gem, although the call to object_id isn't immediately clear:

https://github.com/rails/journey/blob/aa7e7438eb30516c3b72555e6f355c25d6a9c8ed/lib/journey/formatter.rb#L13-L47

@nirvdrum
Copy link
Contributor Author

@nirvdrum nirvdrum commented Jan 14, 2014

I tried removing the "synchronized" modifier from VariableTableManager#initObjectId and that didn't seem to blow things up. Of course, race conditions can be hard to surface. But it went away as a choke point.

@headius headius closed this in ce9b7f8 Jan 14, 2014
@enebo enebo added this to the JRuby 1.7.11 milestone Feb 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants