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

Calling update_rates without a cache file on a puma cluster pins CPU threads to 100%. #112

Closed
joshuapinter opened this issue Feb 16, 2021 · 5 comments

Comments

@joshuapinter
Copy link
Contributor

joshuapinter commented Feb 16, 2021

Prior to setting up a cache file to store the latest currency exchange rates and just have them updated on a daily basis, we were just doing update_rates on our money.rb initializer.

After the first request, all of the puma workers (that were called) became pinned at 100% CPU usage so this is what our development machine's htop looked like at idle after the first few requests:

image

I went down a rabbit hole with puma, thinking it must be the culprit, but it was actually just calling update_rates that caused this. Here is a comparison of what changes between this issue being present or not.

Issue Present

eu_central_bank = EuCentralBank.new

eu_central_bank.update_rates

config.default_bank = eu_central_bank

Issue NOT Present

eu_central_bank = EuCentralBank.new

eu_central_bank.update_rates( Rails.root.join( "rates.xml" ) )

config.default_bank = eu_central_bank

We've moved on by just using a cache file but I wanted to post this here because I searched and I didn't find any Issues documenting this.

@semmons99
Copy link
Member

@joshuapinter can you check if #110 solves your issue?

@joshuapinter
Copy link
Contributor Author

@semmons99 You bet. I'll try and take a look this weekend.

@joshuapinter
Copy link
Contributor Author

Sorry for the delay. I'll take a look this week to confirm.

@joshuapinter
Copy link
Contributor Author

To confirm, I upgraded to 1.7.0 and don't run into the issue, so I think it is now resolved. Thanks for handling and happy holidays! 🎄

@semmons99
Copy link
Member

great. thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants