ProjectSidewalk / SidewalkWebpage

Project Sidewalk web page
http://projectsidewalk.org
MIT License
84 stars 24 forks source link

Project sidewalk on seattle server is slow to load first time #2461

Closed mcdoerr closed 3 years ago

mcdoerr commented 3 years ago
Brief description of issue/feature

When loading the webpage at https://sidewalk-sea.cs.washington.edu/, it takes a long time to load for the first time. Have noticed this on Chrome and Firefox. @uditpatwal and @misaugstad have also noticed the slow load times. The server may be overloaded?

Expected behavior

Faster load times (hopefully below a second!)

Current behavior

takes from 3-5 seconds to load (which feels way slower as a user)

Steps to reproduce

go to https://sidewalk-sea.cs.washington.edu/

misaugstad commented 3 years ago

Yeah I was just testing around, and found that I was consistently getting a load time of 7 seconds for Seattle, 2.5 seconds for SPGG, and 1 second or less everywhere else. Seattle and SPGG are definitely the cities with the most data, but I have no idea which queries are taking a long time when preparing the landing page. Just doing the straight up count of the labels or validations should be instantaneous (verified by running those queries directly on the database). And checking the audited distance is something that we are caching (and I was getting the full 7 second load time on consecutive page loads, so the cached value should be there).

Looks like we need to do some profiling! I just asked Jason for database permissions for the new tables that we added. Once I've got those, I will create a database dump of Seattle so that we have the full thing to test with.

It looks like the /neighborhoods endpoint could be made more efficient. The set of queries to get the list of neighborhoods looks pretty wacky and should be simplified. Might speed things up a bit. Take 1-1.5 seconds in Seattle, ~0.1 seconds everywhere else. But I think that that actually doesn't prevent the page from loading; I think that the map showing up is just delayed for an extra second.

misaugstad commented 3 years ago

Oh and I originally thought that it might be that the server was overloaded, given that the first time I noticed the slow load time was when I knew other people were using the system. But when I did these tests right now, I verified that no one else seemed to be using the website.

misaugstad commented 3 years ago

Also the landing page takes 7 seconds to lead for Seattle, but the labeling guide takes 1 second, so it's clearly something about the landing page.

misaugstad commented 3 years ago

Unfortunately, I have not been able to reproduce the long load times locally, even with the full database dump. It is still taking 6 seconds to get the initial response from the server, but only 1 second from localhost. I am a bit confused, because if it was the computation that took awhile, I would expect to see the issue locally and on prod. And if the issue is sending data over a network, I would expect to see it in every city (plus the initial response is only a few kb)! I think I'll ask Jason if he has any insights here.

prod: Screenshot from 2021-02-23 13-21-09

local: Screenshot from 2021-02-23 13-21-26

jonfroehlich commented 3 years ago

Great idea. Let's ask Jason what could be involved in that "Waiting (TTFB)" portion and if he could run any benchmarks for us either on the server hardware or on the Docker instance.

Jon

On Tue, Feb 23, 2021 at 1:25 PM Mikey Saugstad notifications@github.com wrote:

Unfortunately, I have not been able to reproduce the long load times locally, even with the full database dump. It is still taking 6 seconds to get the initial response from the server, but only 1 second from localhost. I am a bit confused, because if it was the computation that took awhile, I would expect to see the issue locally and on prod. And if the issue is sending data over a network, I would expect to see it in every city (plus the initial response is only a few kb)! I think I'll ask Jason if he has any insights here.

prod: [image: Screenshot from 2021-02-23 13-21-09] https://user-images.githubusercontent.com/6518824/108910333-90f18600-75da-11eb-8aed-99acaad47f3c.png

local: [image: Screenshot from 2021-02-23 13-21-26] https://user-images.githubusercontent.com/6518824/108910339-92bb4980-75da-11eb-9689-003a8175fcbd.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ProjectSidewalk/SidewalkWebpage/issues/2461#issuecomment-784523486, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAML55KD3BVPGNU23RFT7XDTAQMOJANCNFSM4XVQH23Q .

-- Jon E. Froehlich https://jonfroehlich.github.io/ (he/him https://www.mypronouns.org/he-him) | @jonfroehlich https://twitter.com/jonfroehlich Associate Professor, Allen School of Computer Science & Engineering Core Faculty, Urban Design and Planning, College of Built Environments Director, Makeability Lab https://makeabilitylab.cs.washington.edu/ | Associate Director, CREATE http://create.uw.edu/ University of Washington Help make sidewalks more accessible: http://projectsidewalk.io

misaugstad commented 3 years ago

Confirmed, speeds are much faster now after #2471 !