Forums

Slow database

Ever since I had started using database in PythonAnywhere, it is very slow. Especially noticeable when I clicked the database tab, it would take about a minute or two for it to load and show my databases. What gives?

Same here - it just took over a minute. It used to be immediate, so something's wrong / changed.

When did you first notice this?

That's strange. We have had some reports that suggest this behaviour is limited in time i.e. it's really slow sometimes and others it's pretty quick. Is that what you're seeing?

Less than a second, just now. I'll check later.

Yeah it is slow in some times, and very fast in others. As of right now, it is somewhat fast.

Thanks for checking. You're both on the same underlying MySQL instance, and we're working with Amazon Web Services to try to work out what's slowing it down. But as far as we were aware, the only slowdowns were daily at around 23:00 UTC, lasting about half an hour. Judging from what @jgmdavies said above, it might be slow at other times -- so we'd be particularly interested in knowing when those are, as it might help us pin down the cause.

It's fast at the moment.

I'll check now and again, but the day job will interfere tomorrow...

@giles As of right now, 10:43PM Pacific Daylight Time, the database is very slow.

Fast at 07:20 UTC.

Fast at 10:30 UTC.

Thanks to both of you for the data points. @jgmdavies the server is quite busy at the moment, but the bulk of the queries that are running are yours :-S

Thanks giles.

Am I using too much on that sever? I could rethink things a bit.

I'm usually running 5 long-running Bash shells, and the use over each period of say 2 or more hours should be more-or-less constant.

Jim

Hi Jim,

No, I think you're OK -- while you're using a fair bit of CPU, I don't think it's enough to impact other people.

We have a suspicion about what might be causing the problem -- a couple of scheduled tasks belonging to a particular user, not you -- and will be monitoring things tonight to see if we're right on that.

All the best,

Giles

Thanks Giles. I keep an eye on the CPU, and may try and optimise some more!

Best,

Jim

OK, the scheduled tasks that we think might be causing the problems are running, but hopefully this time around they won't cause problems. Please do let us know how things look.

Thanks Giles - I'll check now and again, but probably not at that time ;--)

Don't worry, we don't expect you to :-)

BTW we're monitoring CPU usage closely, of course, as we have monitoring that can give us nice graphs. But this problem doesn't appear to be correlated with CPU specifically. We think it's something to do with the DB read queue -- essentially someone has a scheduled task that's spamming the database with massive numbers queries at a specific time. An inadvertent DoS, we think.