Gideon So Posted August 8, 2017 Share Posted August 8, 2017 Hi, One of our site gets high TTFB. it is about 1400ms. And I check processwire boot time. it is 1311 ms. The sites seems not very responsive. Any reason causes this?? Gideon Link to comment Share on other sites More sharing options...
dragan Posted August 8, 2017 Share Posted August 8, 2017 Have you tried looking into the matter with something like https://processwire.com/blog/posts/introducing-tracy-debugger/ ? 1 Link to comment Share on other sites More sharing options...
Gideon So Posted August 8, 2017 Author Share Posted August 8, 2017 Hi @dragan, Thanks for replying. Got it fixed by uninstall one of the modules. Gideon 1 Link to comment Share on other sites More sharing options...
adrian Posted August 8, 2017 Share Posted August 8, 2017 12 minutes ago, Gideon So said: Got it fixed by uninstall one of the modules. I'd love to know which module was causing the problem 4 Link to comment Share on other sites More sharing options...
Gideon So Posted August 8, 2017 Author Share Posted August 8, 2017 Hi @adrian, It is TinyPNG Image Compression. Gideon 1 Link to comment Share on other sites More sharing options...
adrian Posted August 8, 2017 Share Posted August 8, 2017 3 minutes ago, Gideon So said: Hi @adrian, It is TinyPNG Image Compression. Gideon Are you using a module that has already been posted here, or your own custom one? I am curious if the slow response is only the first time a page is loaded? I feel like the module should be able to cache compressed versions and only ever have to run the call to the service once. 1 Link to comment Share on other sites More sharing options...
Gideon So Posted August 8, 2017 Author Share Posted August 8, 2017 Hi @adrian, It slows down every page load even I made a blank page doing nothing. I found that this module increases the ProcessWire boot time by increasing boot.autoload time. Gideon Link to comment Share on other sites More sharing options...
adrian Posted August 8, 2017 Share Posted August 8, 2017 13 minutes ago, Gideon So said: Hi @adrian, It slows down every page load even I made a blank page doing nothing. I found that this module increases the ProcessWire boot time by increasing boot.autoload time. Gideon Any chance you could point us to the module code? 1 Link to comment Share on other sites More sharing options...
Gideon So Posted August 9, 2017 Author Share Posted August 9, 2017 Hi adrian, Here you are. https://github.com/BlowbackDesign/TinyPNG Gideon Link to comment Share on other sites More sharing options...
adrian Posted August 9, 2017 Share Posted August 9, 2017 3 hours ago, Gideon So said: Hi adrian, Here you are. https://github.com/BlowbackDesign/TinyPNG Gideon Seems like the main problem is that the setKeyAndValidate() method is called on every PW ready(). I just commented that out and load times go back to being normal. I don't know the Tiny API, but I would think it would be possible to either just do this once, the first time the API key is entered, or perhaps if it's needed for each call to Tiny, then it could be called only when one of the hooks is triggered. Perhaps @Roope can take a better look since it's his module. 3 Link to comment Share on other sites More sharing options...
Gideon So Posted August 9, 2017 Author Share Posted August 9, 2017 Hi Adrian, Thanks for the fast investigation into the problem. This is from their document: Quote If you are writing code that uses an API key configured by your users, you may want to validate the API key before attempting to compress images. But I don't think it is not necessary to check the key every page load. Gideon Link to comment Share on other sites More sharing options...
Roope Posted December 19, 2017 Share Posted December 19, 2017 On 8/9/2017 at 8:49 AM, adrian said: Seems like the main problem is that the setKeyAndValidate() method is called on every PW ready(). I just commented that out and load times go back to being normal. I don't know the Tiny API, but I would think it would be possible to either just do this once, the first time the API key is entered, or perhaps if it's needed for each call to Tiny, then it could be called only when one of the hooks is triggered. Perhaps @Roope can take a better look since it's his module. On 8/9/2017 at 11:21 AM, Gideon So said: Hi Adrian, Thanks for the fast investigation into the problem. This is from their document: But I don't think it is not necessary to check the key every page load. Gideon Hi all! Sorry I'm little late for the party. Key validation on every page load is surely not necessary and it was just a simple stupidity be set like that. It's fixed now and I just pushed it to github. Thanks for the notice! (not been using the module after couple of tryouts) 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now