Shoot'n'Score It

I’ve been cooperating with Jens to improve his website ever since 2018. In the beginning, he wanted me to improve his sport shooting site that was done in Django. He needed optimization, so that the site worked faster.

There had been a couple of issues we had to solve. On the website, sport shooting tournament organisers can add info about their events, receive payments and add member scoring. At the same time, the competitors can register to the tournament and follow their scoring. The main issue was that many competitions had a limited number of spots to their disposal, so while the registration to the tournament was open, the movement on the website grew bigger than usual and the site was becoming overloaded. The reason behind it was quite simple: many people had been trying to register at the same time and they had been continuously refreshing the website. Such situations required unique scaling solutions.

I’ve managed to make the site from ten up to hundred times faster, depending on the amount of data processed by the page. It became possible after optimizing database queries, adding caching (so you don’t have to make a database query again for the rarely changing data) and making some parts of the code asynchronous, meaning that synchronous calls do not block (or wait for) the API call to return from the server. The execution continues in your program – it means that the calls don’t block the entire website, but work in the background instead. The website reacts much faster, loads faster and you can use it straight away without any further delay.

I’ve also decided to migrate the site to Python 3, the newest Django, the newest Bootstrap, and AWS. That last migration made the site easier to manage and cheaper.

Then, I’ve also implemented automatic deployments with Jenkins — an automatic deployment tool. After introducing any changes, the site now goes to the server on its own and the workload becomes smaller.

Live scoring has been updated with the help of web sockets. After each shot, the results instantly show up on the website. I’ve also added offline scoring support in case of any problems with Internet connection. It makes offline shooting possible, as the actions synchronize later when the Internet’s back.

I’ve added some new features, too.

Last, but not least, I’ve optimised and fine-tuned the server to make it work as efficiently as possible for the lowest price. It can now serve thousands of users without spending much money. Usually, the servers’ default configuration leaves a lot to be desired and might not serve your application well, being too expensive.