Necromantia Posted February 22, 2009 Report Posted February 22, 2009 Hi, I am not sure if this is known already. But because of the recent actions taken by Manu to lower the server load, I will just let you know. Delete or move if you know this and the solution to it already. Currently the "Live Chat" and the "Players in this location" part poll the server every couple of seconds to get new chat messages and get updates on new players in this location or if some player left the current location. But also very often there is no new message or no player joined or left and the poll causes unnecessary server load. A less load intensive approach would be to use some kind of messaging or listener-like methods. With these methods the clients get only updated (and therefore cause server load) when really something happened (new chat message, player joined or left current location). For example someone types a new chat message and sends it to the server. The server knows all people in the current location and sends them a message that contains the actual chat message. Some server load is caused for the text message. But when the next 20 minutes no one types a chat message, then also no server load is caused. As I don't know the server software/architecture which is in use, I can only explain on this high level. But if you are interested in some assistance you can simply contact me via PM in this forum. Cheers, Necromantia
Burns Posted February 22, 2009 Report Posted February 22, 2009 hm... should the server then remember all messages in a location and send them to each player that passes through? i guess that would add even more load to the servers than the current system... but i'm not sure bout that, i'm no techie :/
Liberty4life Posted February 22, 2009 Report Posted February 22, 2009 O.o chat and online list is updated with ajax, that means your browser is sending small requests in background to server, so that means you can receive new data without whole page getting reloaded, so that really has nothing to do with server load, or at least i dont see way to make it better
Kafuuka Posted February 22, 2009 Report Posted February 22, 2009 [quote name='Necromantia' post='25787' date='Feb 22 2009, 05:43 PM']Hi, I am not sure if this is known already. But because of the recent actions taken by Manu to lower the server load, I will just let you know. Delete or move if you know this and the solution to it already. Currently the "Live Chat" and the "Players in this location" part poll the server every couple of seconds to get new chat messages and get updates on new players in this location or if some player left the current location. But also very often there is no new message or no player joined or left and the poll causes unnecessary server load. A less load intensive approach would be to use some kind of messaging or listener-like methods. With these methods the clients get only updated (and therefore cause server load) when really something happened (new chat message, player joined or left current location). For example someone types a new chat message and sends it to the server. The server knows all people in the current location and sends them a message that contains the actual chat message. Some server load is caused for the text message. But when the next 20 minutes no one types a chat message, then also no server load is caused. As I don't know the server software/architecture which is in use, I can only explain on this high level. But if you are interested in some assistance you can simply contact me via PM in this forum. Cheers, Necromantia[/quote] Technicly you'd still need to send PING request so that the server knows who is still online and whose internet was disconnected. Something i did wonder about was if there's any way to permanently store images on harddisk, I get the feeling this doesn't happen (even if they're cached, cache is cleaned rather often) and images are a lot worse for bandwidth than plain text requests. I suspect most browsers will treat this as a security issue though.
Liberty4life Posted February 22, 2009 Report Posted February 22, 2009 yea noticed same thing, but flash is taking most of bandwidth
Necromantia Posted February 22, 2009 Author Report Posted February 22, 2009 [quote name='Burns']hm... should the server then remember all messages in a location and send them to each player that passes through? i guess that would add even more load to the servers than the current system... but i'm not sure bout that, i'm no techie :/[/quote] The server has to remember, also right now, who is in which location. And the server load problem, as far as I can guess, does not appear because the server has too few ram, but the CPU load is too high. But to speak generally, yes you get a little higher RAM usage, but save lot of CPU usage. [quote name='Liberty4Life']so that really has nothing to do with server load, or at least i dont see way to make it better[/quote] This little request means server load. The server has to check if you request chat message for your current location and not for somewhere else. Then all chat messages for your current location must be send to the client. This is done for every client every 7 seconds (I think that is the current interval). The server also has to do all of that when there are no new messages, which means waste of CPU performance on server. [quote name='Kafuuka']Technicly you'd still need to send PING request so that the server knows who is still online and whose internet was disconnected.[/quote] You are right. But you can do that in much longer intervals, lets say 5 or 10 minutes. Which still would mean much less load then the polling currently done by every client. [quote name='Kafuuka']Something i did wonder about was if there's any way to permanently store images on harddisk, I get the feeling this doesn't happen (even if they're cached, cache is cleaned rather often) and images are a lot worse for bandwidth than plain text requests. I suspect most browsers will treat this as a security issue though.[/quote] This is done in other browser games as well. All images are stored locally and you can set the path to the images on your local harddrive in the game. The links to the images are altered then and instead to point to something like [url="http://magicduel.com/images/image1.png"]http://magicduel.com/images/image1.png[/url] it points to file://C:\your\path\to\magicduelimages\image1.png. This will also reduce server load.
Liberty4life Posted February 22, 2009 Report Posted February 22, 2009 oke i dont get this with chat, if i get it correctly what you had on your mind then it would take long time to notice that someone has written anything in chat, and that would result in me reload page all the time but maybe i misunderstood you
Necromantia Posted February 22, 2009 Author Report Posted February 22, 2009 [quote name='Liberty4life' post='25826' date='Feb 22 2009, 08:09 PM']oke i dont get this with chat, if i get it correctly what you had on your mind then it would take long time to notice that someone has written anything in chat, and that would result in me reload page all the time but maybe i misunderstood you[/quote] Ok. I try to explain it again and give a detailed example. When you are in a location the server knows that you are in this location (he also currently does). When in this location someone else sends a message, the message goes to the server and the server immediately send it to the other players in the location. Now the example in plain text: You (A) go to a Marind Bell Gates (MBG) where 2 other people (B + C) already are. Stay there couple minutes and chat. Then you leave MBG to the Marple Dale Park (MDP). The steps that need to be performed in detail: 1. Tell the server that player A (you) wants to go to MBG. 2. The server accepts it (or denies it, but this is not of interest right now) and registers A in the playerlist for MBG. So the server knows that at MBG currently the players A, B and C are. 3. Player A now types a message and clicks on send. The message is send to the server. 4. The server looks now in his table which players are registered at MBG. He finds that A, B and C currently are in MBG. 5. The server sends (almost immediately, but for sure faster than 7 seconds) the received message back to all players he found to be at MBG. 6. ... repeat 3-5 as often as you want. When A now wants to go MDP (or log out or go idle), the server removes A from the playerlist for MBG and you will not receive any future messages send by player B or C, that stayed at MBG. I hope this makes it more clear.
Root Admin Muratus del Mur Posted April 12, 2009 Root Admin Report Posted April 12, 2009 what u say its done in socket flash chats not in chats like the one here. trust me i am no noob in this, i made the fastest way i could think of, but where is a large amount of notifications required you need to de a large ammount of server interogations., its logic.
Recommended Posts