[solved] Performance problem in linux and Twilight Forest

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here

McJty

Over-Achiever
Mod Developer
May 13, 2014
2,015
2,519
228
twitter.com
Hi all, I'm having a bit of a performance issue in Twilight Forest. I know that TF is a heavy mod which has the potential of adding a lot of lag but I feel that my problem is different because I am actually having REALLY very good performance in TF all the time *except* when I start exploring and (presumably) when lots of new chunks are generated. I will describe my problem in more detail here. First some general info:

OS: Linux Kubuntu 12.04
Computer: 8Gig RAM, nVidia GTX 460
MineCraft 1.6.4 with 163 mods (custom mod pack but based on many of the mods that are also in popular FTB packs). Default MineCraft launcher.
Java: Oracle's Java 7. Options for the client:
-Xmx4G -Xms1736M -server -XX: PermSize=150M -XX:MaxPermSize=256M

I know I'm not using FTB right now but I have a mostly similar set of mods and I think many people here are probably very knowledgable on how to setup a good MineCraft setup on Linux.

So as I told above I basically have really very good performance everywhere. Even in the Twilight Forest I basically have no lag whatsoever. However, when I explore TF and new chunks have to be generated it seems things get very bad. I get about 5 seconds for every frame and even when I pause the lag doesn't stop. It seems my entire system is lagging. When I switch to other programs (chromium, shell, ...) the lag doesn't stop either. My entire system is slowing down to a crawl until I exit MineCraft.

If I exit MineCraft and restart my game then all is fine. The lag is complely gone and I can play as normal.

I'm using Opis but nothing special could be seen there. There were not many entities as far as I could see and nothing spectacular in the profile runs.

So basically I'd like to know if this is a known issue and if there is a solution to this problem. Perhaps there are some better or additional flags that I can use for Java?

Any tips or advice is welcome. Thanks a lot!
 

Wagon153

New Member
Jul 29, 2019
3,148
-3
1
At first I thought you were talking about server lag, and I was gonna recommend a SSD. But it's actually FPS lag? This reeks of corrupted chunks. Try regenerating the Twilight Forest completely.
 

McJty

Over-Achiever
Mod Developer
May 13, 2014
2,015
2,519
228
twitter.com
Yes indeed, it is fps lag. I haven't done too much in the TF so far so I could indeed remove that dimension entirely. I suppose I can just remove the DIM7 folder (I think TF uses 7 as the biome id, at least in my config)?
 

Wagon153

New Member
Jul 29, 2019
3,148
-3
1
Yes indeed, it is fps lag. I haven't done too much in the TF so far so I could indeed remove that dimension entirely. I suppose I can just remove the DIM7 folder (I think TF uses 7 as the biome id, at least in my config)?
Yes, it's ID 7.
 

McJty

Over-Achiever
Mod Developer
May 13, 2014
2,015
2,519
228
twitter.com
Unfortunatelly deleting the TF / DIM7 didn't help the issue. I only had to walk a small way before it suddenly started the super-lag again.
 

fishille

New Member
Jul 29, 2019
57
0
0
I have had a similar issue in the past. Twilight Forest is hard on memory when exploring. SSP or SMP? If server play are any others on server having the issue?
 

McJty

Over-Achiever
Mod Developer
May 13, 2014
2,015
2,519
228
twitter.com
Single player. When I have F3 open I'm still only using about half of my 4Gig that I allocated. It is a bit weird...
 

fishille

New Member
Jul 29, 2019
57
0
0
Single player is hard on a PC and twilight forest in my experience is pretty harsh. It was eating our server up causing everyone issues. Could be an issue CPU side ?
 

McJty

Over-Achiever
Mod Developer
May 13, 2014
2,015
2,519
228
twitter.com
I'm not excluding any problems but the following two facts remain:

1. I have excellent performance otherwise in TF. Anywhere. Before that lag starts I get very smooth framerates.
2. As soon as I manage to exit MC when the lag is in progress (which is somewhat hard) and reload everything is again smooth.
 

fishille

New Member
Jul 29, 2019
57
0
0
Something could be conflicting in your modpack with TF that when generation occurs it is putting the strain on your system. I'm not sure what mods are included in the 163 mods or what versions, but it could help someone help you with more information. Doesn't seem to be an issue with your system per say but the software. If its easily duplicated test by disabling different mods and try it on a different world(back up yours too, to prevent losing work)
 

McJty

Over-Achiever
Mod Developer
May 13, 2014
2,015
2,519
228
twitter.com
That could be yes. This is a world that I had for a while and gradually added mods to it. In the past TF worked fine with this map but there were two major differences:

1. It was on windows. I only recently migrated my MC to linux.
2. It was with fewer mods.

So either there is a Linux specific issue or else a mod I added is indeed conflicting with TF now. Here is a list of the mods I'm using right now:

http://bpaste.net/show/wKGftTc9ujfBFjHCsctS/

Thanks for the help so far!
 

fishille

New Member
Jul 29, 2019
57
0
0
If everything in overworld runs just fine I doubt Linux vs windows is any issue with TwilightForest performance.
I'd try the most recently added mods first. I am always suspect of AM2.... But that may just be a bias then any reality... (Something to do with getting murder by Hecate's a bunch)

I've been told MC runs better on Linux and OsX then windows.. I believe this as my mid-high end PC and my low end Hackintosh are equal on MC.
 

McJty

Over-Achiever
Mod Developer
May 13, 2014
2,015
2,519
228
twitter.com
Yes, I can confirm that Linux does run MC a lot better then windows so I also have doubts that linux is the problem. When I moved to Linux I got much smoother framerate everywhere (ignoring the TF lag for a moment)
 

McJty

Over-Achiever
Mod Developer
May 13, 2014
2,015
2,519
228
twitter.com
Yesterday for the first time I also had this problem in my base in the overworld while just running around and doing things. And also for the first time I found something in the logs that might give a clue to what is happening:

2014-05-16 21:22:20 [WARNING] [Minecraft-Client] Memory connection overburdened; after processing 2500 packets, we still have 281 to go!

And a lot of those. So there seems to be some kind of memory issue going on. Not sure what though. I'm googling around to see what could be the issue but would appreciate any hints here in any case. Thanks!
 

GreenZombie

New Member
Jul 29, 2019
2,402
-1
0
My guess:
You are running out of texture memory on the video card. This is forcing OpenGL to cache textures in system memory - which is, well, making stuff run slow.

Things to try:
Upgrade your video card to one with at least double your current vram.
Reduce your view distance.
Uninstall any 32x or higher texture packs.
Remove any unnecessary biome mods.
 

McJty

Over-Achiever
Mod Developer
May 13, 2014
2,015
2,519
228
twitter.com
Hmm, possibly. This might actually also explain why I didn't have this on Windows because perhaps the video card drivers that I had on windows handled this somewhat better. At this moment the problem is rare enough that I'm not going to worry about it too much. I also added some extra flags (from google) to my Java VM which seems to have improved things a little. I'm not willing to go back to 16x16 textures (using faithful right now) just for this problem.

If it gets worse again there are still a few things I can do. i.e. I can try upgrading the video driver on ubuntu to more recent (but not marked 'current') versions.

Thanks for the help
 

McJty

Over-Achiever
Mod Developer
May 13, 2014
2,015
2,519
228
twitter.com
I still haven't been able to fix this problem and I know now it isn't exclusive to Twilight Forest. TF just triggers it faster. It is also triggered faster when I open my world to LAN and let my son play with me. I googled a bit and found out that this can possibly be caused by the garbage collector on linux freezing the system. It appears to be that the java GC on linux can do this in some cases. I'm wondering if there are ways that I can avoid or tune this so it no longer happens?

BTW, here are my flags. Many of them are GC related but not really a clue if some are perhaps bad or not:

-Xmx3G -Xms2048M -XX:+UseConcMarkSweepGC -server -XX:+UseParNewGC -XX: PermSize=256M -XX:MaxPermSize=256M -XX:+OptimizeStringConcat -XX:+CMSClassUnloadingEnabled -Xnoclassgc
 
Last edited:

GreenZombie

New Member
Jul 29, 2019
2,402
-1
0
"TF triggers it faster" sounds _exactly_ like the problems I had on 32bit windows. Your parameters strongly hint the jvm and hence machine is 64bit tho...
 

McJty

Over-Achiever
Mod Developer
May 13, 2014
2,015
2,519
228
twitter.com
I googled a bit more and found these flags:

java -Xmx1024M -Xms1024M -XX:+UseFastAccessorMethods -XX:+AggressiveOpts -XX:+DisableExplicitGC -XX:+UseAdaptiveGCBoundary -XX:MaxGCPauseMillis=500 -XX:SurvivorRatio=16 -XX:+UseParallelGC -XX:UseSSE=3 -XX:parallelGCThreads=(Number of processor cores you have, for me it's 2) -jar /media/storage/minecraft.jar

I'm going to experiment with that. But it seems that in the flags I'm currently using there are actually some conflicting flags. Some of them select alternative GC methods and I guess you can only use one GC at a time :-/
 

GreenZombie

New Member
Jul 29, 2019
2,402
-1
0
I am, frankly, not expecting anything to come of the experimentation. Java has now been through a rather lot of updates and revisions and the default settings for most of these things are usually optimal.
The only flags you *need* to pass to java are -Xmx and -XX:MaxPermSize, and even these should generally be kept as low as possible (i.e. big enough that minecraft doesn't crash) for best performance.

i.e. the sources of lagieness in Minecraft do not usually include garbage collection: The simple fact is that Minecraft does NOT have smart texture (memory) management. As you proceed through the game (and twilight forest) more and more textures are allocated. If/when you exceed the ability of the gfx drivers to keep the textures on the video card and/or cache them in system memory, Minecraft's fps will start to suffer.

As you wander through twilight forest, you are exposed to more biomes. More biomes imply more unique textures. implies more video memory load.

Allocating MORE memory to java (via -xmx) in this situation frequently has the paradoxical result of worsening the lag as this reduces the amount of RAM available to the video drivers for caching purposes.
 
Last edited: