Hacker News new | ask | show | jobs
by ovex 1311 days ago
Great puzzle. I liked it so much that I saw your message about going live a few days ago already.

Is there any dynamic content generation involved? I am wondering because the Gateway timeout hints at something behind nginx being the bottleneck. Don't you just serve static files? Maybe you could configure nginx to cache dynamic resources if they only change once a day or even consider turning dynamic resources into static resources by generating them once per day and serving them as static files.

1 comments

The problem is I'm not big on devops, so I was just hoping "things will be fast enough"

I just modified the server to serve all images from a cloudflare-based source, hope that will help

Also, it's definitely not just static stuff, it tracks full statistics on how people did in the puzzles so they can compete, and I didn't go very deep on optimizing that yet

turn off statistics for the next day or so.
Now that it loaded again for me, I can see the /graphql endpoint. Caching GET requests to endpoints for a few minutes (or even just one minute) will likely suffice, given that the puzzle is the same for all users. If I am not overlooking anything, stats will lag behind for that period of time in the worst case. More info on how to configure nginx can be found on https://docs.nginx.com/nginx/admin-guide/content-cache/conte.... When a 502 error is served, images or bandwidth are usually not your problem but your backend that is too slow. In your case you probably only need `proxy_cache_path` to define the cache path, `proxy_cache` to specify the zone name you used with `proxy_cache_path`, and `proxy_cache_valid 200 302 1m;`.
this is super helpful, thanks

all stuff I don't know but I should