How Discord Resizes 150 Million Images Every Day with Go and C++

Great in-depth writeup on how Discord struggled to resizing lots of images via their Image Proxy Service:

As Discord grew, the Image Proxy started to show signs of strain. The biggest problem was the Image Proxy did not have an even workload distribution, which hampered its throughput. Image proxying requests saw a wide variance of response times, with some taking multiple seconds to complete.

Eventually they created Lilliput, to resize a scale of images and generating first-frame stills of video:

Lilliput relies on mature, high-performance C libraries to do most of the work of decompressing, resizing and compressing images. It aims to do as little memory allocation as possible and especially not to create garbage in Go. As a result, it is suitable for very high throughput image resizing services.

Lilliput supports resizing JPEG, PNG, WEBP and animated GIFs. It can also convert formats. Lilliput also has some support for getting the first frame from MOV and WEBM videos.

How Discord Resizes 150 Million Images Every Day with Go and C++ →
Lilliput (GitHub) →

Run a PHP script as a service/daemon using start-stop-daemon

In a recent project I needed to permanently run a PHP CLI script; it needed to run as a service/daemon. A few Google search coupons later I got my answer: use start-stop-daemon to make it work.

To not manually type in those lengthy commands it’s possible to wrap these in a handy little script, as shown in the gist embedded below:

“Installation” is straightforward: save the file into /etc/init.d/myservice and make it executable by running chmod +x /etc/init.d/myservice. Change NAME, DESCRIPTION, DAEMON, and DAEMON_OPTS to reflect your setup.

Once done you can start the service by running /etc/init.d/myservice start and stop it by running /etc/init.d/myservice stop. Restarting is also possible by running /etc/init.d/myservice restart.

Verify the running of the daemon by checking the contents of the created PID file: cat /var/run/myservice.pid — It should contain a process ID.

Did this help you out? Like what you see?
Consider donating.

I don’t run ads on my blog nor do I do this for profit. A donation however would always put a smile on my face though. Thanks!

☕️ Buy me a Coffee ($3)

Using Dropbox as an automatic and free Web Publishing solution

In addition to having moved my mail to Google Apps for your Domain I decided to take it to the next level about a month ago by using Dropbox for storing both personal as professional (viz. 3RDS-related) data in the cloud. This decision made me more mobile than ever, as I can access any file, any time, any place; This as well from my PC as from my Mac as from any other Computer that’s connected to the internet. Over the weekend I raised the bar again and started experimenting with Dropbox resulting in a method by which one can (ab?)use that very same Dropbox as an automagic Web Publishing Solution (as an alternative to SVN and other technologies).

Continue reading “Using Dropbox as an automatic and free Web Publishing solution”