26 Mar 2014 · @fiorix
Over the past months I’ve been updating the freegeoip server regularly, aiming at making it simpler, lighter, faster, and easier to maintain.
One of the most significant improvement is that now the server preloads tables that can be accessed by a single key, such as the list of countries, regions and cities. This has eliminated the need of a somewhat complex query that would slow down the server a bit.
While adding this and other features the server code became a bit messy and grew into multiple files. After all, I took some time to review, optimize and clean it up, and the outcome was impressive.
Now, not only the server is about 2 to 3 times faster using the same computational resources, but also the source code is smaller and fits in a single file again. The major reorganization happened in this commit, which was followed by a number of minor subsequent commits with fixes and improvements.
Updates on the go-redis driver have also reflected in better performance of the freegeoip server when Redis is used for usage limits.
Another notable change is how the server is run. A while ago I ended up writing a wrapper to daemonize Go programs, go-daemon, inspired by the good old twistd. It is no longer needed because now the freegeoip server can save its own log file and recycle it on SIGHUP, playing nicely with logrotate.
Also, the freegeoip software now ships with a lua script that can be used by wrk to stress test and benchmark the server.
Besides the optimizations in the server code, there’s one more, which is related to #issue 32 affecting the public freegeoip service. Previous Comodo SSL certificates have been replaced by brand new ones from startssl.com.
I’m very happy with the growth of the freegeoip community as more and more users are following and starring the repository.
Last but not least, I feel like I’m becoming a more seasoned Go programmer after almost one year of hard work and a lot of typing.