Jump to content

Request for MultiCore support! WE NEEDZ IT!!!


Recommended Posts

I thought I would make a request here for something I know we all want. That thing is multi-core supporting Tekkit servers (as a start). I have a machine that has a dual-core in it but not quite 2 GB of RAM. It runs just fine with the exception that the CPU is always 100% and yet I KNOW this server can handle the load. So I did some googling and found out a shocking truth, Minecraft doesn't support more than 1 core/thread!!!! This is a MAJOR issue for servers everywhere because people spend lots of $$$ on 6 to 8 core processors (which technically have 16-cores because of threads) only to use 1 thread. I am requesting that Tekkit SMP supports more than 1 CPU core/thread! It could be split so 1 thread handles the mods (RedPower, BuildCraft, RailCraft, etc.) and the other the regular Bukkit server. I hope the dev team sees this because I feel this issue is of the UP-MOST importance!!! PLEASE HELP ME GUYS GET THE DEVS TO MAKE THIS A REALITY!

Link to comment
Share on other sites

Here's the problem:

Threading programs is pretty fucking hard, there is a reason why almost nobody writes their programs with it in mind.

No... No... Just... No...

Threading programs is NOT hard, anyone who tells you otherwise needs a slap upside the head, threading is one of the simplest programming concepts there is and java makes it stupid easy for noobs to do it without screwing up their entire program because they are too lazy to lock properly and EVERY professional programmer ALWAYS writes their programs with threading in mind.

Minecraft could be quite easily multithreaded but it would have to come from Mojang for a few simple reasons, to multithread chunk and entity processing in the minecraft server you would have to make sure that all containers and objects which are accessed in multiple threads are done so in a way which does not cause concurrency issues, and with java - doesn't cause CME's (ConcurrentModificationExceptions) - which means correct locking on the objects and containers, to do so would require quite a bit of work which if done would need to be completely redone every time Mojang updates the Minecraft server, add on top the obfuscation of the server and the huge division with the various people who do the deobfuscation on what things are/should be named and it becomes an impossible job to do if you want to keep it up to date once done.

That being said, I have come to the conclusion as of late that Mojang is inherently anti-mod based somewhat on their own staffs attitudes towards modding plus their lack of progress on their own mod API, but mostly on the lack of multithreading in their server and my basis for that is very simple. Vanilla Minecraft, as in with no mods no bukkit no plugins no thing, can host huge amounts of players without lag provided you have a server with enough ram and an epic cpu, the biggest issues with tekkit which causes lag is the sheer volume of tile entities and the time costly work associated with ticking them, plus the frequency of chunk loading/unloading due to everyone always flying - add in some badly coded plugins and bukkit's overhead to call them and you have yourself some lag, most of which would be inconsequential were the server properly multithreaded. There is no explanation for the lack of multithreading in the Minecraft server, all I can think is that they wont do it because Vanilla doesn't need it and they wont make code improvements which will specifically help people mod their game.

Link to comment
Share on other sites

Well, speaking as someone who is a coder (Java, C, C++) I know multi-threading isn't hard. But at the same time, Minecraft is exactly built for it. I was thinking that maybe the people who make Tekkit could have at least have two threads where one handles all the mods (their logic, entities, resources, etc.) and the other is just Bukkit. That way lower end CPU's could run Tekkit just fine given enough RAM is available.

Also, I am curious, I have a server that I am running Tekkit on and Tekkit reports "Can't Keep Up! Did the System Time Change, or is the Server Overloaded?" and I am wondering if there is anyway I can speed up my server. (it's because of this that I posted this topic)

My server specs are:

CPU: Intel Pentium 4 Hyper-Threaded @ 3.33GHz

RAM: 2 GB DDR 400

Net: Dual 1000Mbps LAN

OS: Ubuntu Server 12.04 LTS

HDD: 7200 RPM Sata 30.Gbps 160 GB

The server does have anything on it except bare-bones Ubuntu Server, Java runtime, and Tekkit 3.1.2

Link to comment
Share on other sites

Well, speaking as someone who is a coder (Java, C, C++) I know multi-threading isn't hard. But at the same time, Minecraft is exactly built for it. I was thinking that maybe the people who make Tekkit could have at least have two threads where one handles all the mods (their logic, entities, resources, etc.) and the other is just Bukkit. That way lower end CPU's could run Tekkit just fine given enough RAM is available.

Also, I am curious, I have a server that I am running Tekkit on and Tekkit reports "Can't Keep Up! Did the System Time Change, or is the Server Overloaded?" and I am wondering if there is anyway I can speed up my server. (it's because of this that I posted this topic)

My server specs are:

CPU: Intel Pentium 4 Hyper-Threaded @ 3.33GHz

RAM: 2 GB DDR 400

Net: Dual 1000Mbps LAN

OS: Ubuntu Server 12.04 LTS

HDD: 7200 RPM Sata 30.Gbps 160 GB

The server does have anything on it except bare-bones Ubuntu Server, Java runtime, and Tekkit 3.1.2

It's not possible to just run a second thread to handle the mod stuff, the tile entity ticking is what causes 98.9% of "lag" in tekkit, which has to be run in the main thread or every time an entity changes/checks a block/entity you will run into concurrency issues due to the nonexistence of locking, and no one is going to spend the weeks required to add all that locking just to have it all wiped out and need to be redone when Mojang do an update...

If you want to speed up your server, buy a new one >.> or turn off the overloaded report in the config and pretend it never happened ;o

Link to comment
Share on other sites

No... No... Just... No...

Threading programs is NOT hard, anyone who tells you otherwise needs a slap upside the head, threading is one of the simplest programming concepts there is and java makes it stupid easy for noobs to do it without screwing up their entire program because they are too lazy to lock properly and EVERY professional programmer ALWAYS writes their programs with threading in mind.

Minecraft could be quite easily multithreaded but it would have to come from Mojang for a few simple reasons, to multithread chunk and entity processing in the minecraft server you would have to make sure that all containers and objects which are accessed in multiple threads are done so in a way which does not cause concurrency issues, and with java - doesn't cause CME's (ConcurrentModificationExceptions) - which means correct locking on the objects and containers, to do so would require quite a bit of work which if done would need to be completely redone every time Mojang updates the Minecraft server, add on top the obfuscation of the server and the huge division with the various people who do the deobfuscation on what things are/should be named and it becomes an impossible job to do if you want to keep it up to date once done.

That being said, I have come to the conclusion as of late that Mojang is inherently anti-mod based somewhat on their own staffs attitudes towards modding plus their lack of progress on their own mod API, but mostly on the lack of multithreading in their server and my basis for that is very simple. Vanilla Minecraft, as in with no mods no bukkit no plugins no thing, can host huge amounts of players without lag provided you have a server with enough ram and an epic cpu, the biggest issues with tekkit which causes lag is the sheer volume of tile entities and the time costly work associated with ticking them, plus the frequency of chunk loading/unloading due to everyone always flying - add in some badly coded plugins and bukkit's overhead to call them and you have yourself some lag, most of which would be inconsequential were the server properly multithreaded. There is no explanation for the lack of multithreading in the Minecraft server, all I can think is that they wont do it because Vanilla doesn't need it and they wont make code improvements which will specifically help people mod their game.

Good to see you backed it up with well sourced third party evidence.

Link to comment
Share on other sites

You may be interested to know that Optifine Multicore has Multicore chunk loading support. Seriously boosts your FPS if you have Multicore. Which I don't. Which the guy who gave me a modpack I use does. It took me ages to work out what was wrong with my chunk loading, because it loaded every other chunk with a nonexistent core.

Link to comment
Share on other sites

It's not possible to just run a second thread to handle the mod stuff, the tile entity ticking is what causes 98.9% of "lag" in tekkit, which has to be run in the main thread or every time an entity changes/checks a block/entity you will run into concurrency issues due to the nonexistence of locking, and no one is going to spend the weeks required to add all that locking just to have it all wiped out and need to be redone when Mojang do an update...

If you want to speed up your server, buy a new one >.> or turn off the overloaded report in the config and pretend it never happened ;o

I didn't know how Minecraft is coded or what causes the lag, so thank you for clarifying! And I think I'm just going to turn of the message and walk away and forget it ever happened (:D LOL)

Although now that I'm thinking about it, couldn't TileEntity ticks be tracked/calculated on a different thread? I don't know if that would be worth the effort to code or not since I have very little experience coding in Minecraft. Also, does Minecraft server run a logic method on every tick? If so, that is HORRIBLE design and should be fixed ASAP.

Link to comment
Share on other sites

Imagine that you have a tile entity update that switches the redstone state of a block from on to off, but at the same time you have a block change event on a neighbouring block because, say, somebody placed a redstone lamp. It could read the state of the block, see it as on, and turn on the lamp, and then do the tile entity update and turn the block off, causing the block to have been seen in both the on and off state within the same tick. The lamp is now on when it should be off. Even if it gets corrected on the next tick or by forcing another block update, it's a transient error that could have cascading effects. The effects may be small and rare, but they eventually lead to those "Dammit, I don't understand why my redstone computer suddenly stops working..." complaints.

Threading is more than just making sure you've put locks around everything to avoid CMEs; you need to make sure that you maintain consistent behaviour on the whole data model, not just individual fields or objects, and although it's certainly not impossible, it's often much harder than you first expect.

Link to comment
Share on other sites

You may be interested to know that Optifine Multicore has Multicore chunk loading support. Seriously boosts your FPS if you have Multicore. Which I don't. Which the guy who gave me a modpack I use does. It took me ages to work out what was wrong with my chunk loading, because it loaded every other chunk with a nonexistent core.

How do you only have one core? Even my parents shitty comp which can't even run Minecraft properly has a dualcore

Link to comment
Share on other sites

Imagine that you have a tile entity update that switches the redstone state of a block from on to off, but at the same time you have a block change event on a neighbouring block because, say, somebody placed a redstone lamp. It could read the state of the block, see it as on, and turn on the lamp, and then do the tile entity update and turn the block off, causing the block to have been seen in both the on and off state within the same tick. The lamp is now on when it should be off. Even if it gets corrected on the next tick or by forcing another block update, it's a transient error that could have cascading effects. The effects may be small and rare, but they eventually lead to those "Dammit, I don't understand why my redstone computer suddenly stops working..." complaints.

Threading is more than just making sure you've put locks around everything to avoid CMEs; you need to make sure that you maintain consistent behaviour on the whole data model, not just individual fields or objects, and although it's certainly not impossible, it's often much harder than you first expect.

Scenarios such as that can't happen because of the order in which objects are ticked in the game, a block cannot be placed by a player in the middle of any of the entity ticks, only by a TileEntity, in which case if it had anything to do with redstone it would update the physics of the block which recursively updates its neighbours and an issue such as a lamp being on which shouldn't be just wouldn't happen. People often overestimate the complexity of the Minecraft server especially when it comes to areas such as this, multithreading of tick-based world servers is nothing new and nothing difficult, and anyone attempting multithreading would have to be selective about which specific parts of it to multithread and if chosen properly then threading the Multicraft server actually is nothing more than just making sure you've put locks around everything to avoid CMEs.

Link to comment
Share on other sites

How do you only have one core? Even my parents shitty come which can't even run Minecraft properly has a dualcore

It's a laptop. A pretty awesome one, and the only disadvantage is the single core. It's not particularly new, and I wouldn't call it state of the art, but it runs well and can handle most games easily.

Link to comment
Share on other sites

It's a laptop. A pretty awesome one, and the only disadvantage is the single core. It's not particularly new, and I wouldn't call it state of the art, but it runs well and can handle most games easily.

That sounds weird because I don't know how a game and the OS would run well on a single core o.o

Link to comment
Share on other sites

An i5 is definitely dual core.

You sure? Strange, Optifine seemed to ignore the second core and attempt to load chunks with nothing(Resulting in the landscape flashing on and off repeatedly). Looking at the Intel website, it would seem that I do have dual core, but I have no idea why my computer seems to not be using it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...