Closed Maelstromeous closed 10 years ago
Ouch, a friendly DDoS. I can push out an two-minute refresh update, but it will take time until Chrome updates the extension to that version. Can you do something using a caching system right now?
Well this is the thing, the queries to the database are cached, but it's the number of connections to the server (with the extension polling it) that's taking it down.
Damn. By the way, maybe Cloudflare can help you (It's free): https://www.cloudflare.com/overview. Maybe worth taking a look.
We haven't actually until now. I'll make the suggestion to him.
Ok I've put the site on CloudFlare, hopefully it makes a difference. Thanks for the suggestion :-)
I'll let you know when things have settled down, then you can convert it back to 1 minute.
Ok so your update is being pushed, 0.4.2 if thats the update you did it for. I've just been looking at the background page for the plugin, it seems to be making more requests than it should.
I think that it's doing is checking per alert the status of it individually. To lower the requests, could you use just one request for all active alerts and loop through the objects?
I'm using only one request. I have to find out what is calling the update method more frequently than it should. It is supposed to update when:
Let's see..
Yeah something is definitely causing bursts of 3 requests or so, as seen here in my database log:
Ooops, closed by accident. Anyway, I banned the IP 66.177.102.88 from the API for now, as the requests per second were VERY excessive (52k total!). He probably had something like 5 computers all on the same network with the plugin...
I'm wondering if theres a way to restrict requests by IP so it doesn't get flooded like this.
I reduced them even more now. The only situation where multiple requests can go in, is after an error. It will continue to try requesting again after 6 seconds, then 9, then 12 and so on. Is that enough? If yes I'd push 0.4.3. If your server is down, Cloudflare caches and handles the requests anyway, so the number * 3000 shouldn't be a problem. And I'm sorry for the flood. That was not my intention... The 66.x IP sounds like a pretty addicted fan, LOL!
Well I've found out that Cloudflare doesn't cache PHP code, so the queries are still being executed regardless, which is still technically a request.
Maybe if the plugin failed to get data, maybe setting it to trying every 15 second intervals instead? If the server is already bogged down with requests 15 seconds should be more than enough for it to handle it, then get ready to handle the queued requests.
No worries about the friendly DDOS, I guess this is a learning experience for both of us. I'm gonna research into RESTful APIs, see if they will do anything for us.
Ok the plugin is still dropping the server. I'm gonna have a chat with my server guy to see if we can upgrade the number of connections, and look into if we can lower the number of requests.
Hey dude!
I've just got off skype with the guy who runs my webserver, the server is timing out due to the huge number of connections from the plugin.
Now I understand you've reduced it to one AJAX call, which is fine, so we need to come up with some other way, either your side or my side, where we can lower the number of requests made to the server.
I'm wondering about technologies such as websockets, and whether they can be helpful to us in this scenario?
One solution for now just to ease the edge off the server is increasing the poll timer from one minute to two, that'll take the edge off the server and stop it crashing for now.
I thought this wasn't going to happen, but it's the number of http requests that are killing it, rather than database queries (which is something I specialise in more).