Archive for January, 2013

31
Jan
13

Sometimes I make myself happy

One challenge with RummyFight is to constantly optimize the servers. Since there is an increase in both players and playing there will sooner or later be a limit of what the servers can cope with.

At the moment that limit is still pretty far away but I rather spend some time with it now because I want that to do it later because I must.

So what can be optimized then? Well, even though things are pretty fast as they already are there’s always a few milliseconds more to tweak out of the system here and there. My focus lately has been on the “FetchLobbyFights”-routine which is called pretty often by the apps. As a matter of fact, it’s called about 10 times a second at peak time which means that if I can optimize it a little it might make a good difference after all.

So… up until now, the FetchLobbyFights has been a combination of three database calls and some post processing logic. 10 calls a second * 3 = 30 database operations per second and that’s a bit too much according to me. Also, each fetch took about 110ms to make meaning that every minute there’s been about 66 seconds of work for the server (many of them in parallel though)

But with some clever coding I’ve been able to reduce the database calls to ONE per fetch and now the call takes about 67ms instead. This means a reduction of database operations of 2/3 plus a reduced workload of 39%. That’s a lot! And besides making fewer database operations, the one remaining is also a lot friendlier to the database since the sorting is made in the apps afterwards, not in the database (outsourcing the work, anyone?)

And I do like the size of the database query now too 😉

SELECT d1, d2, d3, d4, d5, d6, d7, d8, d9, p1.d10, p2.d10, p3.d10, p4.d10, d11, d12, d13, d14, d15, d16, d17, d18, d19, d20, d21, d22, m.d23, d24, d25, d26, d27, d28, m.d29, m.d30, p1.d31, p2.d31, p3.d31, p4.d32, d33, d34, p1.d35, p2.d35, p3.d35, p4.d35 FROM TABLE1 m join TABLE2 p1 on abs(d1)=p1.d1 join TABLE2 p2 on abs(d1)=p2.d1 join TABLE2 p3 on abs(d1)=p3.d1 join TABLE2 p4 on abs(d1)=p4.d1 join TABLE3 on d2=pk_d2 WHERE (abs(p1.d10)=d1 OR abs(p2.d10)=d1 OR abs(p3.d10)=d1 OR abs(p4.d10)=d1)

All row and table names have been changed in the above query so there’s no use for you to memorize anything. Just wanted to show that I find it amusing that a query with 5 JOIN and a WHERE with mathematical operations can be as fast as it is.

And now… back to the app 😉

Advertisements
21
Jan
13

Some fun numbers

While working hard on the iPhone update of RF to make it v1.48 too, I thought it could be fun to publish some numbers about RummyFight, since they are, in some ways, pretty impressive. At least I think so 😉

So first off, how many people are playing RummyFight?
Well, it’s a difficult number to define. One day there could be X people playing. The next day there could be the same amount but totally different people. Since there can take 72 hours between melds in a FourFight you don’t need to check in every day if you don’t like. But we have defined “active player” as someone starting the app at least every three days and at the moment there are about 22.000 people doing that. If we would increase this to a week, there are almost 40.000 different users playing. What we also know is that these numbers are growing. Every week the “active users number” are increasing which means that not only are new players discovering RummyFight but the old ones stay too.

How many fights are being played
We are getting close to 15.000 running fights at the moment but there are more fights being started than ended every day so it’s a growing number too. You must take into account that some fights last for weeks and some are finished within 30 minutes. Some fights are between two players and some are between four so it’s not as easy as saying 15.000×2 = 30.000 active players either.

How many melds are being done every day
Now this is an interesting number. A meld is when someone makes their move and is a good estimate of how much RummyFight is played. I like this measurement since there are other Rummikub apps out there bragging about having 100.000 active fights. However what’s the use when people only make a meld a week due to slow gameplay? I mean, it’s not the amount of fights or players that are important. It’s how much you PLAY.

Yesterday we scored an all time high with juuust short of 180.000 melds being made during 24 hours. That’s 2 melds every second around the clock. What makes this even more impressive is that 70% of those melds were made between 4pm and 11pm (swedish time) which means that during those hours there were 5 melds being made EVERY SECOND. But yesterday was an all time high. Normally there are about 140.000 melds being made every day, however this is also a number that’s increasing. Just two weeks earlier the average was 127.000 melds per day.

How many data requests are being made every day
Every day? Let’s focus on every second instead. I mean, a meld is one request. A Login is another. Then you have “get bookmarks”, “refresh lobby”, “create fight”, “open fight”, “send gift”, “change settings”, “get statistics” etc etc. There are A LOT of requests from the apps to the servers. At peak times about 200 requests… PER SECOND… which makes the very rapid response times from our servers even more impressive.

So what are the response times then?
Well, it depends on the nature of the request and the amount of data being involved and one need to remove network latency from the factor too. I mean, if you are using a slow mobile connection, it’s not the server’s fault it takes a second or two. The servers were done quickly but then it took the data a while to get to you. Also, some data takes some time for the phone to process and update the interface with too.

However, the average response time of the servers, when not including the time for transferring the data or parsing by the phone, is about 70ms. That’s LESS than 1/10 of a second for fetching active fights, creating new fights, making a meld, etc. That’s faaaast.

How much is people using the chat?
Pretty much actually. Since it was implemented in RummyFight there has been 894.146 chat messages sent.

How much is people playing the hidden game of Tetpuz?
Don’t really know. What we do know is how many Tetpuz games that are finished and scores being sent to the server and that is 865.807 so far.

So what can we expect in 6 months?
Going by the constant increase of new players, increased playing and bigger popularity, probably servers with smoke coming out of them 😉

09
Jan
13

More improvements to come

New year. New challenges!
We are still not done with RummyFight, you know. We are still improving it, piece by piece.

In the next few days there will be a new version for Android available. A couple of days after that the iOS update will be released too. So what have we done then?

Well, there are two major things changed:
1. Dramatically improved graphics for the Android version when using large screens or tablets. Trust me. This will be noticeable. One can almost call it a HD version.

2. Localizations. Yes, finally RF will be available in other languages than english. The Swedish and Dutch translations are already finished and there are Spanish and German on the way. Hopefully we will get them in time for the release.

But wait… there are other improvements too. Like the ability to select your own notification sound, to have text auto correction on or off in the chat, bombs in Tetpuz etc etc.

This will be a really nice update which hopefully will be the last one before putting our teeth into Tournaments. I’m really looking forward to this.

Here’s a screen cap of the new graphics. The new one is on the left and the old one to the right. Click on the picture to get it in full size and then you can really compare. Look especially on the rounded images or the logo.

rf_hd