Digital Ocean server is slowed and uses high CPU

132 Views Asked by At

I have .Net 6 web API hosted on Digital Ocean droplet, using postgreSql, also hosted on DO.

Until today morning everything was working perfectly. In the morning I made some updates to DB and also code.

  1. In DB deleted one table (because it was not necessary anymore) and also removed its references from other table (FK).
  2. Scaffolded to generate context files - Im using EF.
  3. Made changes to code so that everything would be complete together.

I tested everything locally (locally hosted app, but connected to DO hosted DB), it was perfect. After that I published it to server and started it. After that DB and Website are lagging and sometimes doesn't return response.

Symptoms:

  1. Loading home page is way slower.
  2. On the droplet app uses almost 60% CPU, before it maxed at 10.
  3. API services sometimes return result(after a long time) or goes on exception with message: An exception has been raised that is likely due to a transient failure.

Tried to see:

  1. If I had memory leak. But on server I monitored it was stable, uses about 100-120MB
  2. CPU used 60% But could not trace exact processes.
  3. Update DbContext configuration in Program.cs like this
 opts.UseNpgsql(builder.Configuration.GetConnectionString("DefaultConnection"), builder =>
                {
                    builder.EnableRetryOnFailure(5, TimeSpan.FromSeconds(1), null);
                });
  1. Fully restarted droplet.
  2. Made droplet resources a bit bigger.
  3. I also wanted to try to reset Digital Ocean DB, but could not found this feature in admin panel. Is there any way to do this?

None of the above helped. So if anyone had this kind of case, help would me much appreciated. Thanks in advance.

0

There are 0 best solutions below