chiefwigms / picobrew_pico

MIT License
148 stars 63 forks source link

Slow to load Library #81

Closed Intecpsp closed 4 years ago

Intecpsp commented 4 years ago

Hardware/Software: I'm running the beta 3 image on my Raspberry Pi on the latest commit.

Issue: The server is quick to load the homepage, but going to the library clocks for over 30 seconds with 26 recipes. Is it reading every recipe I have in the folder before loading the page? I assume it is to get the names to display. Is there any way to change this set up to speed up the reaction time? Possibly an SQLite db with a basic name -> json mapping? That could also allow for a checkbox in the UI of which recipes the devices can see.

chiefwigms commented 4 years ago

I just created 30 dummy recipes on my pi 0w and don't see this, the load is instant. Try clearing your browser cache. Also could be something with your network, but i don't know how you're setup

Intecpsp commented 4 years ago

Let me play around with it, because I'm seeing it with different devices. It actually looks like anything past the homepage takes over 30 seconds to view.

Intecpsp commented 4 years ago

So I've tried this with many devices and still seeing the issue. I will note that I am connecting to the pi from my main network (so 192.168.1.139:8080), I don't think that would cause this lag, but wanted to note it. I also watched my CPU and RAM on the Pi while clicking through and saw little to no fluctuation. After getting past the homepage, every other page loads instantly. It's just leaving the homepage is where the issue is at. Something else to note is that I have 7 devices showing on my homepage (2 Pico C, 1 Still, 4 Ferms), and none of the are currently logging.

tmack8001 commented 4 years ago

Wonder if that has to do with the socketio stuff as if anything that is what is different about from index page and rest of the pages. Are any of the devices sending session data?

Intecpsp commented 4 years ago

Not yet, I haven't shifted to the offline server yet (that will be happening on my next brew). So right now the server is just housing my recipes and configured for all of my devices once I switch.

tmack8001 commented 4 years ago

So right now is just aliases for the device with no traffic? Hrm, interesting.

Let us know if you find anything, so far I haven't seen that in the various setups I've configured with.

chiefwigms commented 4 years ago

Might be worth getting a zip of your picobrew_pico so we can try to run on our Pi's - there may be other files causing issues (Mac related)?

Intecpsp commented 4 years ago

Interesting find: It works with no issues in Safari 13.1.2, but has issues in Chrome 84.0.4147.125 and 86.0.4221.4.

chiefwigms commented 4 years ago

Interesting find: It works with no issues in Safari 13.1.2, but has issues in Chrome 86.0.4221.4.

I'm on 84.0.4147.125 - (latest for win x64, or at least that's what the about section says) and I don't see it. The only browser issue I've run into is tabulator not working with Internet explorer

Intecpsp commented 4 years ago

Well that makes things more interesting. That same version on my Mac and 84.0.4147.111 on Android is having issues

chiefwigms commented 4 years ago

did you clear your cache/history? try loading in an incognito tab and see if the issue persists

Intecpsp commented 4 years ago

I've done all my testing in incognito/private tabs to get around all the cache issues. I'll try actually clearing everything and see how that turns out.

Intecpsp commented 4 years ago

Still seeing the issue after clearing cookies and cache from "All Time" and quitting/reopening the app.

chiefwigms commented 4 years ago

Haven't messed around too much with it, but maybe try opening a developer tools page ("Settings->More Tools"), and look at the timeline in the network tab, might give a hint

Intecpsp commented 4 years ago

Ohh good call, didn't think about that.

It sits here for a bit: Screen Shot 2020-08-11 at 10 12 24 AM

And then eventually gets here: Screen Shot 2020-08-11 at 10 13 13 AM

chiefwigms commented 4 years ago

Can you send me a zip of your folders or at a minimum your recipes?

Intecpsp commented 4 years ago

The only thing not "stock" is my config.yaml and these recipes. Everything else is from the latest image and commit. pico.zip

chiefwigms commented 4 years ago

The only thing not "stock" is my config.yaml and these recipes. Everything else is from the latest image and commit. pico.zip

Loaded all those in to my recipes folder, load is instant swapping between main/Pico recipes 🤷‍♂️

Intecpsp commented 4 years ago

Well, this sucks. I have a non-reproducible issue :(

chiefwigms commented 4 years ago

If you know python, you could add a bunch of prints in app/main/routes_frontend.py around line 266 @main.route('/pico_recipes') def _pico_recipes(): That would probably help you narrow it down a little

Intecpsp commented 4 years ago

I've dabbled in Python and actually used it in college, but I main C# at my day job. I'll play around in the code and see if I can come up with anything.

Intecpsp commented 4 years ago

Just to verify I'm not crazy: AS SOON as I click Library it kicks off _pico_recipes(), correct? If so, it took 45 seconds to hit my first print before global pico_recipes.

chiefwigms commented 4 years ago

Yes.. were you monkeying with any of the nginx or setup for the pi?

Intecpsp commented 4 years ago

I have not, the only things I've change were config entries in firstboot (before starting the image) and then the config.yaml

msav72 commented 4 years ago

Hey, guys.

I am having an issue as well. looks like it affect chromium (new edge and chrome) IE I can navigate from menu item to menu item instantly . Chrome/edge just sits there forever and eventually loads the page.

If I restart my docker container, edge and chrome are fast for about 2 mins. then back to super slow.

I do have over 200 recipes in there though

Intecpsp commented 4 years ago

@msav72 is it from the homepage to any other, or just to Library?

msav72 commented 4 years ago

It is slow from the home page to the either of the sessions or to the recipe library. Basically from the homepage to any other menu item. I get waiting for down at the bottom for about 45 secs to 2 mins. once out of the home page eveything is quick, even going back to the home page but upon leaving the home page I always get delay.

I would Use IE but IE does not show the new recipes data or any of the picofirms and pico still on the home page.

even going from the home page back to the home page results in a delay.

chiefwigms commented 4 years ago

Do a git pull - I just updated tabulator to 4.7.2 (from 4.7.1) - not sure if it'll resolve anything though, but its worth a shot. Going to the about page will take a little time to load since there's background work if you're on a PI to get AP/host info, however if you went from the home page to the Import page on Pico, that'd give a good indication that the issue lies in Tabulator. Even without issues, I notice a slight lag (couple ms) when expanding any cards - if you open developer tools you'll see warnings: Added non-passive event listener to a scroll-blocking 'touchmove' event. Consider marking event handler as 'passive' to make the page more responsive.

Intecpsp commented 4 years ago

I still see the issue after getting the latest and even restarting the pi. I did see an instance where right after the homepage loaded again, from doing an "Update/Restart Server", I flipped to the about screen to verify I was running the latest and it was really quick. Then I went back and tested it and found the slowness back. Looks to be the same behavior msav is seeing after restarting their container.

If I restart my docker container, edge and chrome are fast for about 2 mins. then back to super slow.

chiefwigms commented 4 years ago

Tested again w/ Chrome 84.0.4147.135 (latest) - still don't see this... try updating and see if anything changes?

Intecpsp commented 4 years ago

I still have the issue with:

Chrome: 84.0.4147.135 Server: 24b73a0

Intecpsp commented 4 years ago

I just re-imaged and saw the fast transitions. Added my recipes, still see the speed. Add 1 Pico C and 1 Still in config, still see speed. Add the rest of my devices (2 Pico, 4 Ferms, 1 Still), sloooow. Flip config back, fast.

My thought on re-imaging was that there was a library that I updated that the site didn't like. But it looks like there is something with my config entries. Everything is in quotes, see redacted below:

aliases: Zymatic:

ProductID : Nickname

ZSeries:

ProductID : Nickname

PicoBrew:

ProductID : Nickname

"fe84" : "Pico"
"e7ff" : "Pico2"

PicoFerm:

ProductID : Nickname

"5c62" : "Ferm1"
"6088" : "Ferm2"
"6049" : "Ferm3"
"2c19" : "Ferm4"

PicoStill:

ProductID : Nickname

"30f8" : "Still"
chiefwigms commented 4 years ago

k - so this is repeatable - I have 7 devices up.. page loads between recipes/sessions is fine, its just navigating from the main page - i think something w/ socketio is causing the issue.. i'll take a look when i get a chance

chiefwigms commented 4 years ago

do a git pull.. should be good

Intecpsp commented 4 years ago

I'm still seeing the issue on 28037b9, even tried rebooting the pi

chiefwigms commented 4 years ago

Can you try force refreshing/a new private page? It was a change in the js/html, so it might still be cached

Intecpsp commented 4 years ago

That was it! Works in incognito!