go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
45.05k stars 5.49k forks source link

Loading home page when authenticated takes 5 minutes and 40 seconds #4437

Closed asonix closed 6 years ago

asonix commented 6 years ago

Description

When logged in, loading the dashboard takes 5 minutes and 40 seconds. This is a consistent number, leading me to believe there's some event that times out, the variation in response time is between 5:40.1 and 5:40.6. I'm not sure what timeout this is, but I feel like it should either be configurable, or less than one minute. Waiting for a page to load for more than 30 seconds is a little bad imo.

A thing to note, this only started happening after I physically moved my infrastructure somewhere else, so whatever is timing out is likely looking for a network resource that no longer exists.

asonix commented 6 years ago

Followup. I also noticed that gitea wasn't loading my icon from gravatar. After setting my own icon on Gitea, the dashboard loads much faster (20 seconds, instead of 5 minutes and 40 seconds). Is it possible that there's a single gravatar request taking that long? My guess is it checks gravatar many times in the dashboard request, and those checks are sequential.

A possible fix could be caching the gravatar result per-request, instead of checking again on failure. For context, I'm the only active user on my gitea, and my icon is displayed on the page 30 times.

techknowlogick commented 6 years ago

@asonix Do you have libravatar enabled?

Can you open the chrome (or FF) dev console and look at the network flow and their timing?

asonix commented 6 years ago

"Federated avatars" are enabled, "disable gravatar" is disabled, so it should use gravatar.

The network console doesn't help, since it is the initial request that takes 5 minutes. Everything else the page loads comes in quickly. The 5:40 number was actually something I pulled from the server log.

asonix commented 6 years ago

Also it looks like libravatar is shutting down soon. That's a shame. I didn't know it existed until today

techknowlogick commented 6 years ago

@asonix Well hopefully it's not shutting down, I, and a couple others are working on making sure it doesn't shut down.

But that makes some sense for the page load. Libravatar does DNS lookups to make sure that the correct avatar is displayed, but for some domains this request takes a while (there is built in caching, but I believe that only happens when there is a successful DNS response, need to confirm this though)

Ping @strk

ghost commented 6 years ago

For those who may work on this please review the following article from Steve Souders before addressing this https://www.stevesouders.com/blog/2010/06/01/frontend-spof/

ghost commented 6 years ago

Also it looks like libravatar is shutting down soon. That's a shame. I didn't know it existed until today

We'll come up with something better. If it's not sustainable it's probably a sign of a design flaw.

mqudsi commented 6 years ago

@jhabdas while it's important to always keep SPOF in mind, I don't think that's directly relevant to this issue since it seems to be a backend delay/hang and not in the browser?

techknowlogick commented 6 years ago

Closing as dupe of #1287