Online Web Development tools. All free, all provide an API. Simple Quick and Fast!
About a week ago, I started getting reports that PostBin was giving out 500 errors. I started looking into it but couldn't figure out where those errors were coming from.
Let's just say it's been an interesting week since then. This is the story.
On Monday (Day 1) I managed to just test out creating my own bin, sending a few requests to it, and watching it disappear after 30 mins. All seemed well, I replied to the emails hoping it was just an ephemeral error. Alas no.
On Tuesday (Day 2) more reports came in. Another test. Seemed fine. I looked at the code and started mulling over my architecture. I had a Heroku app with a free MongoDB instance. Was MongoDB breaking at the seems with all the requests, after all I seem to get hit around 4 to 5 million times a day!
Yep, you heard that right. PostBin gets hammered between 4 and 5 million times per day. Unfortunately though these requests are not actually using PostBin correctly and instead are just hitting various bins that no longer exist! Every so often when I tail the logs there are bursts from the same IP for the same bin with the same User Agent, and they all end up as 404s.
This somewhat annoys me, and whilst I knew we got hammered, there's really no explanation as to why people - well, let's be honest - programs/tests/CI would do that.
On Wednesday (Day 3) I start to tinker with the old code on the site. I do a lot of housekeeping such as:
On Thursday (Day 4) I didn't do any coding but I did wonder whether I should bring PostBin back in-house (ie. from Heroku to a Digital Ocean server) and whack MongoDB on there for good measure. It'd be local, fast, be allowed much more disk space and perhaps help with the load.
That evening I got to work but luckily before I did, I had a fabulous idea. For a long time (since about 2011 in fact) I've been a big fan of LevelDB and especially so using Level on Nodejs, so I figured that this would be the ultimate in speedy storage for something as simple as a RequestBin, PostBin, HTTP Test, or WebHook Testing service. Yay! This was starting to get exciting.
That evening I started coding and within a couple of hours I managed to
lib/store.js (the MongoDB specific code) to the new
which was the LevelDB specific code. The server started and the tests
passed. We were good,
commit 574b48bda36a76c7973d497872b1594ddad215a4 Author: Andrew Chilton <firstname.lastname@example.org> Date: Fri May 17 00:04:27 2019 +1200 Switch over from MongoDB to LevelDB .eslintrc | 30 -- README.md | 5 +- lib/db.js | 218 ++++++++++++ lib/middleware.js | 14 +- lib/routes/api.js | 15 +- lib/routes/bin.js | 8 +- lib/routes/home.js | 9 +- lib/routes/inspect.js | 8 +- lib/store.js | 223 ------------ package-lock.json | 1006 +++++++++++------------------------------------------- package.json | 7 +- server.js | 11 +- set-env.sh.EXAMPLE | 14 - test/basic.js | 21 +- test/collector.js | 7 +- 20 files changed, 478 insertions(+), 1133 deletions(-)
As you can see, the commit was just after midnight and bam, I had to go to sleep.
On Friday (Day 5) I did quite a number of things including (but not limited to):
So far this was all going well and so I deployed onto the new architecture and we were away! I added a lot more bans over an hour or so and again, finally, it was time for sleep.
On Saturday (Day 6) I completely switched over the frontend from Bootstrap v3 (!) to TailwindCSS v0.7. It is now in keeping with all of the other services we provide under the WebDev.sh banner. With a couple more tweaks for development purposes, we've managed to re-design and re-architect the entire app in the space of a week.
Which only leaves Sunday (Day 7) left. Ah, a day of rest and even though I'm not religious it's been an intense week so I deserve a break.
My thoughts are now for the future and what will happen with PostBin. It's yet another service I provide with love to anyone but because of the inordinate amount of crap being shovelled into it, I'm thinking I need to take a slightly different route.
This time I'm going to add new features in the future for registration and then creation of API Tokens so I can check who is doing what. It's not something I ever wanted to do, but with the amount of traffic battering the site, I can't keep up with the cat and mouse game of banning IP Addresses as and when I notice them.
And with that, I bid thee farewell and I hope you enjoy both the new design and the new service.
Posted: 8 months ago