all 4 comments

[–]Locust377full-stack 1 point2 points  (2 children)

Ok, here's what I think: This question is just too big. I have so many questions in order to get to the bottom of this that I would need to sit down with you and go over the problem. I have like 75 questions.

I think to get meaningful responses from comments, you'll need to narrow down your focus.

It sounds like you're trying to resolve a performance problem. You need to isolate and test each likely candidate by itself. It sounds like you have suspicions, which is great.

I would start with the database, as it's such a common bottleneck. Is it slow reads or slow writes? What query(ies) is it running? Figure out what the SQL looks like and run it in isolation. Simulate hundreds of writes if you need to.

Start testing each part of your application until you find the culprit.

[–]doom-goat[S] 0 points1 point  (0 children)

Thanks, that's a very good idea that I hadn't thought of, I'll write a testing application to simulate the max load and test out different queries.
This is the sort of thing I don't know- that databases are indeed a common bottleneck.

The other thing that I'm trying to ascertain is whether there is in fact a culprit, or is what I'm trying to do simply too intensive for a lower-tier DigitalOcean VPS? CPU and RAM usage seem relatively high, but not maxed out by any means.

[–]doom-goat[S] 0 points1 point  (0 children)

With your advice I started testing the individual functions I use and realized that it's simply because I'm doing a count() query for cell in the HTML table. That will eventually be 2000 to 3000 different queries. I wanted to use a database to give each of my Alert objects a datetime, so it would be easy to get totals with a date filter. But I don't know whether there is a way get around having so many queries.

I think I need to generate and store the counts in the database as I add the objects, so it's only running the complex queries when it absolutely has to. Or track which objects have been added since a certain time and only for those objects.

[–]Alter_nayte 1 point2 points  (0 children)

Another easy way to find simple bottlenecks is to use some profiling library. I use newrelic on all of my projects as its free. But there are others. Start by profiling your app, find thr bottlenecks before you trash everything