[SUGGESTION] Standby mode for craftbukkit? To reduce cpu/electricity consumption.

Discussion in 'Bukkit Discussion' started by sleepysonic, Oct 27, 2011.

?

Would you like a standby mode for craftbukkit?

  1. Yes

    35 vote(s)
    89.7%
  2. No

    4 vote(s)
    10.3%
Thread Status:
Not open for further replies.
  1. Offline

    sleepysonic

    I host my own server so I can play with up to 5 other people. The vast majority of the time though there is no one in the server (we like to play at night).

    I want to keep the server up 24/7 so that anyone can join at any time of the day. But currently doing so keeps the cpu processing constantly despite no players being logged in. I know this isn't going to be good for my electricity bill and my cpu fan remains noisy all day.

    Are there any plans or ways to keep the server 'online' and ping-able from within the multiplayer window but in a standby mode thus using no cpu usage and only activating once a player connects? I think this is an important feature and could drastically reduce power consumption as well as cpu load for anyone hosting small private servers, which would be great! Think of the environment! It's the same kind of proactive development that craftbukkit appears to aspire to. I can imagine it would be helpful to many minecraft server providers out there too.

    Do you agree? Is there a way to already do this? I want to host a creative server and a survival server at the same time but the constant cpu/power usage scares me.
     
  2. Offline

    Toe_Jam

    It's a good idea.
     
    np98765 and sleepysonic like this.
  3. Offline

    codename_B

    I'll look into this.
     
    np98765, JOPHESTUS and sleepysonic like this.
  4. i support this idea.
     
  5. Offline

    mindless728

    the way to do this is to have a very low power server running that accepts the ping requests and when people join it turns on the actual server using wake on lan feature (it needs to have one) and then redirects all packets to and from the server

    a possible change is instead of low power server, if your router is compatible with DDWRT you could have the router do this by writing the program to run on it instead of a low power server
     
  6. Offline

    Don Redhorse

    well if your "server" hardware would do powermanagement for the cpu, spindown of harddrives etc.. you could do something like this...

    enhance mcdoor so that when a player on a whitelist tries to join mcdoor unloads
    create a plugin which shuts down the server when no player is online for a certain amount of time
    create a script which loads mcdoor first and than when mcdoor unloads bukkit
    and let that go back to load mcdoor
     
  7. Offline

    sleepysonic

    Dawww you guys :). I don't know why but I was expecting everyone to just abuse me and call me stupid :p. I've had too much experience on internet forums I think lol.

    I was contemplating posting this in the plugin suggestion section but I wasn't sure if this kind of thing was possible in just a plugin. All that we really need that is missing is an application that can emulate a minecraft ping and possibly add a delay to the connection process on the other end to allow enough time for craftbukkit to be booted up. Preferably without using java ^_^... That would be an easy way of doing this.

    Maybe to extend the idea further... something like a "World Handler" that could allow for launching many different worlds on different ports? This would be good for keeping old worlds still accessible without needing to keep the specific craftbukkit opened and active. If you wanted to go even further then you could place limits on how many different craftbukkit sessions could be opened and running at once on a single computer.

    But mindless728 makes a very good point. Having the option to wake up other LAN network servers and keep the "World Handler" software on an ultra-low powered device like a router would make it even better. You could run it on a raspberry pi! However it sounds like there is a big hurdle with that...

    ^ That sounds like the most complicated part. Is that a particularly easy thing to program? And does that require cpu usage? It would be fantastic to be able to do it that way if possible. Whilst we're at it we could make the "World Handler" support UPnP, which I know is another feature missing from the craftbukkit software.

    If redirecting the packets is not a viable solution then the messy bandaid way would be this: The "World Handler" would have to be in control of the port and the address, but then be able to let go of the port and so that the networked server can open a craftbukkit session on it. And then be able to catch it again once the server ends. Providing the IP address is the same, then it would work. Hmm but that would only work well for a single internet IP address and not for local network IP addresses. By that I mean, if 192.168.1.2 is the "World Handler" server IP and 192.168.1.3 is the craftbukkit IP then it can't be dumbly swapped over unlike if you were connecting from a single same internet IP. Not only that but you would have to have both servers set up to forward ports correctly via the router, which may be a hassle if people are doing it by using DMZ on their router which only allows ONE networked computer full access. I have to use DMZ for my server currently because my modem is such an old dumb piece of crap that doesn't do port forwarding well :) . But you wouldn't have this issue at all if we could do it mindless' way with redirecting packets.

    And if you wanted to go even FURTHER you could get the "World Handler" to keep all the world data as well and be able to use the connected LAN servers as commodities. So for example, you could have 5 different PC's connected via LAN and you would be able to specify what server PC you want to use for what world, maybe even automagically changing it to more powerful PC servers based on how popular the minecraft server is. I can see that being more of a feature for service providers though rather than people running small servers at home. It would help for power consumption further though, perhaps 2-3 player servers could run on Atom, and then if it becomes more popular it would be run on a core2duo instead, and further on to an i7. Maybe I'm thinking a bit too extravagant with this though.

    And then of course a simple plugin to close a craftbukkit session after a specified time of inactivity. I guess the "World Handler" would also need to know when this occurs to be able to keep track of what worlds are no longer opened.


    What is this 'mcdoor' you speak of? I can't find any reference of it, is that a suggested name you made up or does this mcdoor exist already? I do understand what you're saying though, that'd be an easy way to do it.
     
  8. Offline

    mindless728

    @sleepysonic redirecting packets in general isn't hard, its that for this type of application we need some sort of deep packet inspection going on so we know what to do with the packet and whether or not t is a minecraft packet

    now keep in mind that the device that is redirecting the packets also need to keep track of when the server is in a low power state or not. When the packet needs redirecting it has to check to see if the server is awake or not, and if not send the wake on lan packet to it to wake it up then wait for the system to become ready for the player. Then the other interesting problem is being able to tell when the server goes to sleep, in all honestly the best way i can think of is a plugin that puts the server into a low power state after being idle for more than X minutes (idle == no players)

    as for the multiple servers with multiple worlds, the redirection machine would need to keep track of the power state of each individual server (see above) and also keep track of what players are on what server. When a player tries to connect you need to redirect all packets too and from the correct server based on which one he should be on.

    the last thing you mentioned with load balancing, this is almost non-trivial because if the server gets too many people you need to live migrate the server from the low end machine (atom) to a high power machine (i7) which combined with putting machines automatically in a low powered state might be trouble some since the machine you want to migrate may be asleep and need to be awakened and then the server has to be moved. The big problem with moving servers is you either need to suspend the current one which could time out everyone connected if it takes to long or try to keep the server running and get the servers in sync then start moving people 1 by 1 to the other server which could take a bit of time as things would keep changing in possibly both worlds. The synchronization also leads to the problem whether or not you want to sync all entities as well so that players moved don't disappear based on which server they are on during synching possibly causing it to take more time.

    btw sorry for the big blocks of text, but it is the easiest way to keep the information together that is relevant
     
  9. Offline

    Greylocke

    not to be a buzzkill or anything, but for a server with 5 users any modern OS should do a fine job of power management.Before re-writing craftbukkit, here are some practical things that you can do right now.

    • Buy a power meter like the Kill-A-Watt. They are not very expensive, they will show you exactly how much power your whole system is using, and when you're done with this exercise it is fun to use it on other home appliances. :)
    • First and most important, make sure to make appropriate adjustments to your power profile. These settings will be different for each OS, but look for hard disk spindown, CPU power throttling and core processor states, and display timeouts. With no one online, all your CPU cores should be very close to zero% utilization. If not, figure out what is still active.
    • Turn off your displays when your are not using them and consider unplugging them since they pull a few watts even when 'off'.
    • install a fan controller. There are some online for free that work for most hardware. It will only spin the fans as fast as they need to, to keep temperatures in a set range.
    • If you want to throw a little money at this, buy an efficient power supply. Cheap power supplies waste a LOT of power -- all that heat coming out the back? Wasted electricity.
    • If this PC is only a server, either use the on-board video or buy a cheap low-wattage graphics card.
    • Buying a "green" hard drive will help some, too.
    Lastly some perspective. Considering that the average cost of electicity in the US is about $0.10 per kilowatt-hour, even if your system pulled 300 watts 24 hours a day, it would still only cost about $0.72 per day to run.
     
  10. Offline

    TnT

    A dev would likely need to answer this:
    Would it be possible to make a plugin that unloads worlds, plugins, (and everything else) and listens for the packets the client sends upon connecting? Thus when a client connects, those connection packets causes the plugin to kick off loading everything again. The cons of this is that initial connection may time out, or take a very long time to connect. I would think that may be an acceptable trade off.
     
  11. @TnT
    That would definitely be possible. Have your plugin shut off all other plugins and unload worlds after a certain amount of inactivity.
     
  12. Offline

    Don Redhorse

    + MCSignOnDoor 1.4 http://forums.bukkit.org/threads/8814/ client notification server

    is the plugin I was speaking off.. sorry to get the name wrong.. but with the stuff I posted above you could make such a think... otherwise I don't really think it would be worthwhile..
     
  13. Offline

    yttriuszzerbus

    I love this idea
     
  14. Offline

    sleepysonic

    true, simple answers are often the best answers. Wow I had no idea something like that already existed. That sounds like exactly what we need :) . This should be pretty possible.

    Starting to sound a bit complicated :( . Is there perhaps a way of changing the connection details in the client remotely? For example, a player tries to connect to "someserver.minecraft.net" but instead have the server throw back to the client/player a different server setting like "someothersever.minecraft.net" and have it connect automatically like as if it was the original server they had inputted. Then you wouldn't need to redirect packets at all, and the player wouldn't need to know the specific address of the other server. I'm guessing that would require a local plugin on each computer though or mojang implementing something like that into their software. If MCSignOnDoor can already throw back custom messages then this sounds already pretty possible with a client side plugin.

    Wow. I was actually resigned to the idea that the server would need to be shut down to migrate, not live migration! You're probably right, it seems like too many things could go wrong trying to do it live.

    True. If we wanted a band-aid solution we could get MCSignOnDoor to throw back a message like "Server is now booting up, try again shortly". Do we have any information about how long the client will wait before timing out? This too might be something mojang could implement.

    Yes I agree it probably is doing a fine job. My concern is really just when there is no one in there. At the moment task manager has java.exe jumping between 1%-7% cpu usage every second. So if I had two running at the same time, that would be 2%-14%, if I had three then 3%-21%, with no one playing, also 200MB of ram required for each. I know it is nitpicking a little, but doesn't a completely idle processor use much less power than something constantly using a small % of cpu power?
     
  15. Offline

    Greylocke

    The OS will adjust the clock speed and multipliers to throttle down idle CPUs so that they don't run any faster or hotter than they have to. Both Intel and AMD have utlities that allow you to watch it in action. Pretty cool, if you're into that sort of thing.

    I am not sure what you mean by "two running" or "three running". As I look at my server right now, no one is online (everyone is trying the latest 1.9 PR). Top reports CPUs 1-3 at 0% and the fourth moves between 0.3% and 0.7%. YMMV

    The system discussed above sounds cool and all... but I think a little common sense tweaking is all a 5-person server requires. Its up to you how much time you want to invest into saving a few cents. I'd rather play Minecraft. :)
     
  16. Offline

    sleepysonic

    Yes I do have speedstep enabled on my processor. However by the sounds of my processor fan, I don't think it's keeping it clocked down when running the servers (I should test it). But despite that, it isn't just about the clock speed, it's about the power consumption. An idle processor running at 2.8ghz vs a 2.8ghz processor running at full load have a big difference in electricity usage. The point i'm making is, there is no reason for any cpu usage whatsoever if there is no one in the world. Perhaps one day there might be reason to keep it going if we get persistent animal breeding or something, but currently there is no reason.

    I did trail off the point a bit with my 2nd post regarding an elaborate LAN configuration, that isn't a particular feature I would have a use for currently.

    Well I only have a 2.8ghz core2duo, so that's probably making my overall cpu % higher than yours. What I mean is running multiple craftbukkit servers on the same computer. I'd like to have one creative server, and one survival server, with both being accessible at the same time. But all of that constant processing will eventually add up. Although you are using less cpu%, you are also running a quad core system, which would use more power anyway, which defeats the purpose.

    It's certainly an issue that is only a problem for unpopular servers and I guess I am nitpicking. Sometimes my friends don't log in for a week at a time though, having something constantly processing for 168 hours when it could be 0 hours instead I feel is an issue.
     
  17. Offline

    Don Redhorse

    well that is really where hosters come in.. with shared servers.. or even better with virtual servers in a loadbalancing / powermanaged cluster environment... aka cloud.

    But that is overkill... we have our server running piggyback on our normal gaming servers.. so somebody is always using the server... maybe not minecraft, but tf2 or l4d2 or whatever..
     
  18. Offline

    circles

    I have a Win7 media/minecraft server I use with my brother and I was thinking of setting it up for wake-on-lan and just poke it whenever we needed to use it. I haven't actually tried it yet as the basement is not yet wired but I can't imagine there to be any problems.
     
  19. Offline

    Acrobot

    To make Java (and CraftBukkit) reduce CPU and Electricity consumption, you'd have to edit your startup line, to tweak garbage-protection, also - you shouldn't set the minimum memory allocated.
    Other than that - it won't use CPU if noone is online, that means that your "Reducing CPU power consumption" would be done.
    Even more - you can use Intel's processors, which use the SpeedStep technology - they reduce the CPU clock speed by checking its usage. If it's not used, you won't have to worry about power consumption.

    Also, if you're really into energy consuming, you should look into Less Watts.
     
  20. Offline

    Simanova

    Not only Intel can do this. Every modern cpu is able to clockdown.

    Please add an standby mode to craftbukkit!
     
  21. Offline

    Nathan C

    Yep, I know the modern CPUs do clockdown, if they don't have as much load, like when their is no players on the server. Think it is called SpeedStep or something with Intel and AMD also has this.

    Also not sure what would be the purpose in this anyway. When you purchase a server, you pay a flat fee and can drain as much power as the server can possibly drain, without your monthly bill going up. This applies to both shared, dedicated and VPSs.
     
  22. Offline

    3ric

    Well there's people like me who don't trust 3rd party hosts, and like to handle the server themselves.
     
  23. Offline

    Maleckai

    I don't have too much to contribute to the discussion here, but I very much support this idea.
    I also run a home server, and I too have noticed it using about 20-25% CPU even with no players connected and nothing happening.
    Anything that can be done to reduce CPU (and, in turn, power) usage, would be a great benefit to me and any other Bukkit users running a 24/7 home server.
     
  24. Offline

    Rjames426

    I think this is a great idea, I too run a server from home with players on main at night.
     
  25. Offline

    sleepysonic

    Here's what I think is possible to do now..
    What if craftbukkit is scripted to exit after a certain amount of time if there are no players. When it exits, it starts up MCSignonDoor.
    When someone tries to connect, boot up craftbukkit and throw the message back "Starting up server, please reconnect in 30 seconds" and then exit mcsignondoor. The player then reconnects soon after when the server is up.

    That would be fine enough for me. Does anyone know of a way to keep all that craftbukkit stuff hidden when opening? I imagine the window automatically opening and closing would be annoying if trying to use the computer.

    someone go make this! lol. it sounds easy enough. And then I will be able to run a server and not have to worry at all about electricity.
     
  26. Offline

    Lacrosse

    I am very interested in this idea. I, however, don;t know how to go about making this possible, but if someone could I'm sure many people would use this feature!

    I run a 24/7 server, and during the day, like 5:00 A.M. to maybe around 1:00 P.M. There is no one on, or maybe 1 person.. Any hours besides those there are usually around 10-20 people on.
     
  27. Seriously how can a cpu use speed if no one is on your server. When my server is idling it takes up 3-4% of cpu usage (java that is) and that's on an E-350 cpu. For the people who don't know it.... You can find those things in netbooks!!!

    So basically every modern cpu will stay in idle mode when no one is on.
     
  28. Offline

    Vincs

    Hello,

    I'm very interested into this.

    There is no plugin to do that ? :(
     
  29. Offline

    codename_B

    You can do it with a .bat file (and a modified mcsignondoor that shuts down after someone tries to connect)
     
  30. Offline

    Vincs

    I'm running it on my synology but I don't know how to do.

    I don't know how to stop the server if no one is connected neither how to restart it.

    I will look into it. If someone finds out, please tell me. :)
    (If I find out first, I will tell.)
     
Thread Status:
Not open for further replies.

Share This Page