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.
- In DB deleted one table (because it was not necessary anymore) and also removed its references from other table (FK).
- Scaffolded to generate context files - Im using EF.
- 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:
- Loading home page is way slower.
- On the droplet app uses almost 60% CPU, before it maxed at 10.
- 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:
- If I had memory leak. But on server I monitored it was stable, uses about 100-120MB
- CPU used 60% But could not trace exact processes.
- Update DbContext configuration in Program.cs like this
opts.UseNpgsql(builder.Configuration.GetConnectionString("DefaultConnection"), builder =>
{
builder.EnableRetryOnFailure(5, TimeSpan.FromSeconds(1), null);
});
- Fully restarted droplet.
- Made droplet resources a bit bigger.
- 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.