Tag: go

  • The way I like to compile my Go programs – Makefile

    I was on a quest to search for the Holy Grail of Go programming, and I found something, which I doubt that it is, but close enough – at first sight.

    I have several problems with GO, first, that I write my code on an OSX box, and I’ll run the programs on Linux hosts, so I have to solve the cross compilation; my second problem with Go is that I don’t really like the “There is a GO project folder, and all the GO projects are relying on” approach. It makes using GitHub painful.

    (more…)

  • Streaming MySQL binary logs for backup

    With MySQL, it is relatively easy to create “point in time” restores. All you need is a recent(ish) backup and a bunch of saved binary logs. You can restore the backup you have, and when it is completed, you can use the mysqlbinlog utility to apply your saved binary logs to the desired state of your database.

    I have created a simple go application to make your life easier. You can find it on my GitHub page.

    (more…)

  • My first impressions about Go language

    I am fascinated. Maybe that should be enough, but I guess I have to write a bit more here because we are not on twitter.

    I spent a few days getting to know the Go language, and now I am more than satisfied. I mean, all the project ideas which are floating in my head should be written in Go.

    First of all, I have rewritten Mambo-collector to go (https://github.com/banyek/mambo) because I have faced some serious errors when I used it on CentOS 7 – I blame systemd -: If the process was running as root then after a few days of data collecting, killing that process led to the entire system restarting, which is not a bug. It is a catastrophe. I tried to debug it in several ways, but I am not sure where the problem is, it could be at the ‘loghandler’ redirection or any other place in python-daemon, or there is simply a buffer inside which overflows – I don’t really care, because mambo was just a proof of concept – that I used in production. I decided to abandon the project, and rewrite it in a language that is designed for what mambo is: a system process with a high amount of parallel data processing. In the original version, I spawned an os thread for every query which will run (and we know that there is no real multithreading in python because of the global interpreter lock, at the end, building a multithreaded application in python is just an illusion. It is good for helping you to imagine what will happen inside your computer, but you cannot expect real multithreading. It wasn’t a real problem because I only ran/run a few queries with mambo – replication lag, all processes inside mysql, active processes inside mysql – but if there were a need to increase the number of queries that could lead to trouble. And it’s needless to say if you have a lot of time.sleep in your program, that is not the wisest use of your CPU resources: if a CPU is sleeping, then you waste resources. I have enough resources to waste a bit, but it always disturbed me.

    At the end, I decided to rewrite mambo in go.

    (more…)