image_pack_path takes 1/3 - 2/3 of a second to complete? #101
-
Hello! Thank you to anyone that is willing to help me out. I am not sure if this is a bug or a mis-configuration, but I am stuck and have no idea what could be causing it. I have a production server I am trying to get ready which is giving worrying performance times due to shakapacker methods (a minute to load a single page! The browser times out, but I see the logs finish with 200 in a minute). Versioning informationRuby version: 2.7 BehaviorExpected behavior: relatively quick generation of asset version/host for each path when calling image_pack_path Log OutputOverall time for route
Timing for a sample of webpacker methods
As you can see each asset takes 1/3 to 2/3 of a second to generate the path. ConfigurationHere is anything I found that could be relevant to the current situation, this is not the entire config file relevant config in webpacker.yml
relevant config in application.rb
ExtraThis is my diagnostic code for webpacker methods, I have used it before to create better error messages when providing bad file paths (since WebpackerAssetNoFound prints the entire manifest). I am also using it for getting timing information. You can skip this if not interested |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @LukeClancy Thanks for the repro steps, much appreciated! Definitely not getting such slowness as you:
One thing stood out to me This means you're compiling assets on every request as it's hitting this If dev server is not running or compile is set to true in webpacker.yml, you will get this behaviour. I expect this is where the slowdown is, at the moment webpacker gets all the assets and calculates digest for them. I'm working on a PR #97 to speed this up drastically. How many assets have you got just to get the idea? Have you set To see if the digest compilation is the cuplrit, you could benchmark how long this method runs for https://github.com/shakacode/shakapacker/blob/v6.2.0/lib/webpacker/compiler.rb#L54-L73 Finally I see you've got In general, try set |
Beta Was this translation helpful? Give feedback.
Hey @LukeClancy Thanks for the repro steps, much appreciated!
Definitely not getting such slowness as you: