Jump to content

Practical Suggestion to Fix Update Lag


Bart
 Share

Recommended Posts

Operating on the presumption that P&W currently tries to calculate update for all nations at once I'd propose the following system to fix the lag at update. Add two fields to the database:

  • Last update cycle (i.e. long int): Hold a number indicating which update cycle the nation is currently in.
  • Active since last update (i.e. boolean): Holds a flag to indicate whether the nation was active in the last update cycle (user logged in, was attacked, etc.)

As you hit update and the cronjob/timer runs the update script, you instantly update all nations which were active since the last update. These are folks who are most likely online or to be attacked and should be a few hundred nations at most. This will most likely cause the server to choke up for a few seconds as it currently does but should process fairly quickly. Now wait for a minute or two as folks run their attacks, the server will see heavy load and you'll be queuing up a lot of user-induced DB operations.

In the meanwhile, if a nation which is still in the previous update cycle sees a "hit" (login, someone views nation page, etc.) you instantly run the update queries for that nation and present the updated page, this should be fairly limited and avoid heavy throttling as currently occurs.

About 5 minutes after update, you make a list of nations still in the previous update cycle, and you queue up update for them in batches of 50 or 100 and run them at a steady pace (i.e. 50 nations per 15 seconds) that's quick enough to get through all nations but slow enough to avoid excessive server load.

Advantages of this system:

  • P&W stays available throughout update.
  • Peak load on DB server is minimal.
  • Almost no one will notice any side effect other than maybe an increased page load time if they view a non-updated nation.
  • The need to update "inactive" nations on first view will throttle the speed at which users can run blitz attacks at update, making it fairer to people with slow connections.

Disadvantages of this system:

  • More back-end logic.
  • Slight overhead by requiring checks.
  • Might need more frequent integrity checks (i.e. once a day) to see if no one is left behind in an older update cycle.
  • Large batch API calls might be tricky to combine with this sort of system around update.

 

  • Upvote 4
  • Downvote 1

I solemnly swear Lord of Darkness is up to no good.

Link to comment
Share on other sites

For queuing you can use something like this: https://www.rabbitmq.com/queues.html 

I solemnly swear Lord of Darkness is up to no good.

Link to comment
Share on other sites

Good thought but tbh I think the easiest solution at this point would be to extend the down-time of the game at update.

Give the server time to process everything and basically limit the actions of players during this time. So rather than 7:59-8:01 have "Politics and Snore" start at 7:55 and run til 8:05.

 

That way certain people don't update faster than others and it's not such a "sprint" on the server-side of things.

  • Upvote 1
Link to comment
Share on other sites

20 minutes ago, Bartholomew Roberts said:

Good thought but tbh I think the easiest solution at this point would be to extend the down-time of the game at update.

Give the server time to process everything and basically limit the actions of players during this time. So rather than 7:59-8:01 have "Politics and Snore" start at 7:55 and run til 8:05.

 

That way certain people don't update faster than others and it's not such a "sprint" on the server-side of things.

Uhm no, you're grossly misrepresenting a fake solution that worsens the issue. The entire point of this proposal is to avoid the Politics & Snore screen, giving people a chance to fight on equal ground. Right now you can queue tabs and hit submit as update comes up if you have a good connection.

Also there is no "rush" to update, this proposal is entirely transparent to the user and it's only effect is levelling the playground for everyone. Off-setting politics & snore simply shifts the issue over time.

This method would also allow the game to grow and use multiple servers.

I solemnly swear Lord of Darkness is up to no good.

Link to comment
Share on other sites

18 minutes ago, Bart said:

Uhm no, you're grossly misrepresenting a fake solution that worsens the issue. The entire point of this proposal is to avoid the Politics & Snore screen, giving people a chance to fight on equal ground. Right now you can queue tabs and hit submit as update comes up if you have a good connection.

Well, if the goal is to give people a chance to fight on equal grounds his solution might work too. He just went in the opposite direction of you. Instead of evening out the playing field by prioritizing active nations to reduce the wait he's suggesting you increase the wait for everyone, which could also serve as a kind of equalizer.

However, while I do think your solution might help it seems like a losing cause. The fact that update is in the middle of the night or extremely early in the morning for a lot of players puts them at a disadvantage as well and I don't see how cutting down the waiting period at update would help that.

Edited by Big Brother

orwell_s_1984_oceania_s_currency_by_dungsc127_d97k1zt-fullview.jpg.9994c8f495b96849443aa0defa8730be.jpg

 

 

Link to comment
Share on other sites

3 hours ago, Big Brother said:

Well, if the goal is to give people a chance to fight on equal grounds his solution might work too. He just went in the opposite direction of you. Instead of evening out the playing field by prioritizing active nations to reduce the wait he's suggesting you increase the wait for everyone, which could also serve as a kind of equalizer.

However, while I do think your solution might help it seems like a losing cause. The fact that update is in the middle of the night or extremely early in the morning for a lot of players puts them at a disadvantage as well and I don't see how cutting down the waiting period at update would help that.

Uhm, who gives a damn about the daily turn over? There's no significant difference between that one and the update that happens every 2 hours from a programming point of view. And you very much do have the politics & snore screen every two hours, and it's a major disadvantage for folks with slow connections. And giving it a set time span, as the above gentleman o' fortune suggests, only worsens the issue, since that then means you can queue up tabs to launch attacks at a given time and just count down.

  • Upvote 1

I solemnly swear Lord of Darkness is up to no good.

Link to comment
Share on other sites

36 minutes ago, Bart said:

Uhm, who gives a damn about the daily turn over? There's no significant difference between that one and the update that happens every 2 hours from a programming point of view. And you very much do have the politics & snore screen every two hours, and it's a major disadvantage for folks with slow connections. And giving it a set time span, as the above gentleman o' fortune suggests, only worsens the issue, since that then means you can queue up tabs to launch attacks at a given time and just count down.

I mean, I do. I find having to stay up until 2 am when I have work or the class in the morning to be far more problematic than having to wait a few minutes. I haven't really experienced any problems with the snore screen at all but I guess that could be because my connection might be better than that of others. You're right that there's no difference from a programming point of view, only from a gameplay point of view, for obvious reasons. But hey, I can see your mind it set on this so I'll just quietly be on my way. Good luck with getting your changes through.

orwell_s_1984_oceania_s_currency_by_dungsc127_d97k1zt-fullview.jpg.9994c8f495b96849443aa0defa8730be.jpg

 

 

Link to comment
Share on other sites

On 11/16/2019 at 7:42 PM, Big Brother said:

I mean, I do. I find having to stay up until 2 am when I have work or the class in the morning to be far more problematic than having to wait a few minutes. I haven't really experienced any problems with the snore screen at all but I guess that could be because my connection might be better than that of others. You're right that there's no difference from a programming point of view, only from a gameplay point of view, for obvious reasons. But hey, I can see your mind it set on this so I'll just quietly be on my way. Good luck with getting your changes through.

Oh, I agree the daily update is ridiculous, the caps should be reset 24 hours after purchase, that way it's fair for everyone.

50k.gif

Edited by Bart
  • Upvote 1

I solemnly swear Lord of Darkness is up to no good.

Link to comment
Share on other sites

I don't know enougb about the server drag to judge if this would work.

An approach I'd like to see is allowing people change when their daily update is, with limits on how long you can change it after buying units to prevent abuse.

GnWq7CW.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and the Guidelines of the game and community.