New sponsor system on the way

Bubbles, FC Sunnyvale Developer 25 March 2022, 14:08

It's time for an update from the development department.

Framework upgrade

As I mentioned earlier, we needed to upgrade our framework. We did this in smaller chunks, and the latest version was rolled out on the servers in February.

This means that we are now totally up-to-date with the latest versions of both Rails and Ruby, giving us a lot of new options.

Performance issues earlier this month

However, after the upgrade to Rails 7, some performance issues popped up which occurred sporadically and for no apparent reason.

We saw, for example, that our web servers could run fine for a long time without using much RAM, but then a single worker on a single server would suddenly start eating all the memory, which eventually resulted in the operating system shutting it down.

In addition, we experienced the database suddenly became slow, without any explanation. There was no particular load, no slow queries, it didn't run out of RAM and used less than 10% CPU. Normally, our monitoring systems will tell us if our own code contains something that is causing it to run slowly, but there was no sign of that.

We were actually very close to moving the database over to a new server. But before we got started, I decided to upgrade our web servers to double the RAM so that we could have a respite to focus on the database.

But, after we did that, the database problem disappeared. Our theory is that when the web server workers were shut down, their connections to the database did not shut down nicely, and therefore fewer and fewer of them became available - this agrees well with our observations that the database didn't appear to be congested at all, despite running very slowly.

We spent a lot of time investigating the web server memory leak, but never got to the bottom of it, and I did not think it was prudent to spend more expensive developer hours on it when we have a lot of cool projects we want to get started on.

Instead, we set up a system that detects when a worker starts to gobble up all the RAM - when that happens, it is closed and restarted in an orderly fashion, and everything runs smoothly. It's stupid but it works. Our theory is that some of our code must have an unfortunate interaction with the new version of the framework that no one else has yet experienced or documented because it is so new.

The plan right now is to await future patches as Rails version 7 becomes more widespread.

New sponsorship system

We are currently working on refreshing the sponsorship system.

The clubs receive offers from various sponsors. If you accept an offer, that's what you'll get next season. You have to accept an offer before the season update.

Offers have a number of requirements, which must be met before you can enter into them. It could be:
- play in a certain division
- number of stadium seats
- youth squad in a certain division

Some sponsors will have higher requirements than others. This means that you might get offers that you cannot accept right away, but you will then know what to work towards.

The offers will have a base amount, which is based on VIFA rank and on the specific requirements in the offer.

Offers can have a number of different bonuses that you can choose from. A bonus will always reduce the base amount - but the prize is only given if you meet the requirement during the season. Therefore, you'll need to carefully consider whether or not to accept the risk.

The base amount is paid on Monday morning. Any bonuses are paid out during the week if the conditions can be met in the middle of the season (eg "Win X matches in a row"), or at the season update if they depend on the final standings.

The first offers will start coming in Monday morning. This way we avoid everything having to happen on Sunday night. In addition, there will be a mechanism where you can reject an offer and ask the sponsor to come up with something different.

We are also considering whether to implement the possibility of bonuses with more long-term goals. It could, for example, be that you have 4 weeks to move up twice, which would then give a very large pay-out.

I expect that we will soon have version 1 with the basic functionality ready, so that I can show you screenshots and more details about the gameplay.