top | item 24565406

Roughly 2000 blogs running on a $7/month dyno

95 points| HermanMartinus | 5 years ago | reply

Bear Blog (https://bearblog.dev) has just hit 2000 blogs.

Due to the optimization of DB calls, the text-only content (no static files) and Cloudflare's awesome CDN, my single Heroku dyno is running at only 31% capacity.

Full stack: - Django/python running on a Hobby dyno - All HTML content is generated using Django templates - Postgres also on a Hobby dyno - Cloudflare CDN (free) - Sendgrid for confirmation emails - LetsEncrypt SSL certs

Thought this may be interesting :)

63 comments

order
[+] helsinkiandrew|5 years ago|reply
I would have thought that the number of blogs/total amount of content any site can serve is theoretically infinite.

It’s the rate of requests it can handle that matters, which may explain why I’m getting an “Application error” page at the moment

[+] tyingq|5 years ago|reply
There are, I imagine, some tricks for lots of virtual hosts. Like not running out of file descriptors if they each have their own log. Or watching for bloat in config files. Apache, at least, used to bog down on startup with thousands of VirtualHost directives. Or perhaps an acme cert renewal script that runs serially and takes a looong time to finish.
[+] mmcwilliams|5 years ago|reply
This is a great achievement! What kind of traffic does that translate to, if you don't mind sharing?
[+] HermanMartinus|5 years ago|reply
It's been sitting at about 300k pageviews a month, which is not that much considering. If there are high-profile blogs running I may have to consider upgrading.
[+] giancarlostoro|5 years ago|reply
Just learned HN now lets you click on links in the original post now, I think before you had to highlight the URL. Also the site seems to be getting back a 520, but after a refresh it works. I'm guessing it's getting more traffic than usual today. :)
[+] Nextgrid|5 years ago|reply
You can probably get even higher performance for your money by switching to a VPS like a Linode (and on a single machine with limited RAM, SQLite might perform better for read-heavy workloads than running a database server).
[+] Communitivity|5 years ago|reply
I hope you post traffic statistics here as a comment when you do a post-mortem of the traffic that brought it down. I'm interested testing a site under a load similar to page 1 HN traffic.
[+] 3pt14159|5 years ago|reply
If you're already on Heroku, you may want to autoscale your web dyno. It's pretty sweet and keeps the bills low unless you get a surge of traffic :)
[+] HermanMartinus|5 years ago|reply
Gotcha, just turned that on. I wish I'd done that this morning. I didn't think this post would make it to the front page of HN.
[+] colesantiago|5 years ago|reply
Beautiful. I hope this setup serves you well, and doesn't seem you need kubernetes or any of that overkill complex setup.

Just ship on heroku and you're done.

[+] tyingq|5 years ago|reply
He may have spoken too soon :)
[+] thrownaway954|5 years ago|reply
the site seems to be throwing an application error from heroku. now correct me if i'm wrong, but isn't cloudflare supposed to be a caching proxy? and if i am correct, why am i even getting to the actual server? is it this dude doesn't have cloudflare configured correctly? if anyone can explain this i would love to know so i don't make the same mistake in the future.
[+] tyingq|5 years ago|reply
Some CDN software actively thwarts Cloudflare with things like Pragma: no-cache or Cache-Control: no-cache, or bad Expires settings for static assets. Spend some time learning cache headers and then do some testing to see what actually produces a "hit" to the web server under the cache, and how long the various caches (browser, cloudflare, app, etc) last.
[+] chaitanya|5 years ago|reply
If the upstream returns an error over HTTP, the CDN won’t hide it.
[+] gvpmahesh|5 years ago|reply
Looks like it went down, after posting it here
[+] cpursley|5 years ago|reply
This would be free on render.com or netlify as a static site and wouldn't be suffering the hn kiss of death.
[+] HermanMartinus|5 years ago|reply
Well this has become an....ironic post *laughs sadly

It looks like it's back up now.

[+] _mkef|5 years ago|reply
Fantastic alternative to Medium.

If I get into blogging again I might try this.

[+] siscia|5 years ago|reply
Congrats!

How did you market the project for other people to use?

[+] tuananh|5 years ago|reply
i used to run a WordPress site with 5M views per month on $20 instance of DigitalOcean. It was ~7 years ago.
[+] codegeek|5 years ago|reply
and now its not running at 31% only :). HN hug of death.