Cuberite Forum
RAM usage - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Discussion (https://forum.cuberite.org/forum-5.html)
+--- Thread: RAM usage (/thread-1420.html)

Pages: 1 2


RAM usage - LilleCarl - 03-24-2014

Hello!

I read somewhere around there that one user will consume about 50Mb RAM. I come from World of Warcraft servers and is just interested in: Where does all this RAM get consumed?

I mean the block class (cBlockInfo) Doesn't contain that much information, how many blocks are we really loading? (I am stumped, because 50Mb is a LOT of dataTongue)

Regards! =)


RE: RAM usage - xoft - 03-24-2014

Hi, welcome to the forum.

The world data. The minecraft world is 256 blocks high and each client "sees" 10 chunks in each direction. This means a 21x21 area of chunks needs to be loaded for each player; each chunk having 16x256x16 blocks. Each block needs 1 byte of BlockType, 1/2 byte of BlockMeta and 1 byte of lighting data. Multiply all these together and you get the base memory usage:
21 * 21 * 16 * 256 * 16 * 2.5 = 72253440 = 70560 KiB ~ 68.9 MiB

Here's a minecraft wiki article on Chunks, to give you the overview: http://minecraft.gamepedia.com/Chunk


RE: RAM usage - LilleCarl - 04-03-2014

Thanks a lot for the data, this makes sense now! I didn't know the chunk stuff! =)


RE: RAM usage - LogicParrot - 04-07-2014

I like to reduce it to 4 chunks, this turns it into:
5 * 5 * 16 * 256 * 16 * 2.5 = 4,096,000 = 4MB for each player ^_^

Doesn't anyone feel that Minecraft servers are "dumb" in this regard? If I have a block if 50x50x50 which is made of the same block type, it definitely shouldn't be represented by 50*50*50*2.5 bytes, it can be represented by:
start x, start y, start z, end x, end y, end z, block type, which is just a couple of bytes.

Why isn't there any form "compression"?
I understand compression is a tradeoff between CPU Cycles and memory, but if the balance is correct it can be quite nice.
What's the reason nobody does this (Including the official server) Is it just technically hard to implement?


RE: RAM usage - bearbin - 04-07-2014

They're called octrees, and the performance impact isn't great. There was quite a good article about it a while back, but I can't remember where it was. ATM, we're working on sparsing - just removing 16x16x16 areas composed of air only. The progress for that is coming along well, the RAM usage is already cut in half.


RE: RAM usage - LogicParrot - 04-07-2014

Thanks for the term "octrees". I learned something new today Smile

Can something similar be done with 16x16x16 dirt/stone/water blocks? That would reduce memory a lot because that's pretty much ~80% of the world.

Is the server smart enough to not load the same chunks twice when two players are at the same area?


RE: RAM usage - bearbin - 04-07-2014

It could be done, I think. But most underground areas aren't entirely stone - there's lots of ores, air and other impurities in the ground so the results wouldn't be that good (maybe a 3% ram reduction for 25% less speed).

Actually, water might be a good candidate. Wouldn't have the biggest impact, but oceans are quite big.


RE: RAM usage - LogicParrot - 04-07-2014

What about water?


RE: RAM usage - bearbin - 04-07-2014

Had just posted that before you replied. It might be a good candidate to compress, if the sparsing algorithm is easy to extend like that.


RE: RAM usage - LogicParrot - 04-07-2014

I still believe that dirt/rocks are good candidate. There are impurities but there's also a lot of consistency.
Some testing is required, I will test out how consistent the underground is and report back. This probably also depends on the world generator settings.

Also, perhaps a generic algorithm could be used in the future assuming it's efficient enough. That is, an algorithm, which compresses anything when it's 16x16x16 of the same block type. This would also compress player built structures and such.

I decided to do less guess work and test this. I picked a rather large area and converted all stone into air with SafeEdit.
Result is attached.