timofeysie / dot-one

A social network platform in vanilla React
1 stars 0 forks source link

Site is too slow #14

Open timofeysie opened 6 months ago

timofeysie commented 6 months ago

Load times when the user is visiting the site for the first time that day are over 20 to 30 seconds.

The site is hosted on Heroku. This consists of a front end app, and a backend server based app. The server app also stores data on a freely hosted ElephantSQL.com database.

We can increase the speed by using a paid tier at Heroku. The backend also uses Django serializers which are known to have bad performance, so this is something else that can also be addressed.

My Tundra 64 app app is also hosted on Heroku, and it has decent load times. So this is what we are aiming for.

Tundra 64 was an app to create automated posts based on trending google searches. The posts were then meant to show up in google search results and generate a small amount of ad clickthrough revenue.

However, the site performed poorly dues to it's Angular architecture. It was apparent that it would never be able to achieve good SEO (Search Engine Optimization) so I created another project called Ruffmello which solves these issues by using the AMP framework along with a static site generation technique using React (Preact actually, a lightweight version of React) via the Vercel framework. Ruffmello.com loads blindingly fast and would perform well if SEO is done properly.

This second approach is the best fit at least for the list of posts and polls.

timofeysie commented 6 months ago

Heroku has a slightly more expensive tier called "Basic Dyno" which I have applied to both the frontend and the backend: Screenshot 2024-03-23 095456 We can evaluate the performance there, as well as look at paying more for the elephand database.

timofeysie commented 6 months ago

With the current Heroku upgrade, the site itself loads in about 4-5 seconds, but then the API calls and the associated database queries add another 3-4 seconds (shown as the loading spinners). There are two issues with this time:

  1. Django serializers are slow
  2. Elephant DB free tier.

Regarding point 2, the Elephant DB has the following comical names:

Currently we are on the "Tiny Turtle" option. I don't know what performance increases the other options would provide.

Also, I actually don't think it's worth considering any of these for a few reasons. One is that there is a message on their site that reads "ElephantSQL will discontinue its services. The product will reach its End of Life on January 27, 2025".

So this is what is known as "technical debt". There are a number of other items that belong on this list (such as the legacy React version) so I will open another issue to discuss solutions to them there.