Subnautica frametimes & frametime spikes

DC_DarklingDC_Darkling Join Date: 2003-07-10 Member: 18068Members, Constellation, Squad Five Blue, Squad Five Silver
This can be considered a topic for the bugs sections, but I shall let the mods fight over that.

Lets debate subnautica's frametimes.
For the uninformed, frametime is how long it takes to deliver your frame on screen. Most experience this as stutters, or worse.. freezes, if the frametime for certain frames is high.

Now subnautica's frametime has been... quite poorly. A full second freeze or longer isnt totally uncommon. Now surely we all do our 'jobs' and use the ingame feature to report, but I like to spark a debate and see how its going for everyone else.
Because performance is always a issue to discuss, regardless of early access or not. (I mean, we do not want performance to be acceptable only starting from years after release now do we?)

So on hunt for the frametime spikes!


Tested on
  • Latest experimental build.
  • First gen i7 970 @ 3.20.
  • 12GB of triple channel DDR3 ram.
  • Subnautica installed on a hybrid disk.
  • Phantom GTX 770 4GB. @ driver version 347.88. (due to a gsync/ulmb issue I currently can not update to higher.. Ticket with nvidia pending)
  • Gsync is not functional in subnautica & the driver is set to performance for subnautica.
  • Creep vine areas.

Results between days of testing varies.. If this is due to new builds or due to the testing itself needs to be determined. (By more testing)
Uq6RM7Z.png
  1. The big big frametime spike you see in subnautica on the left corresponds to roughly a second of nothing.
  2. It is accompanied by a drop to 0% (or close to) on the gpu as seen at the topright corner.. Yes, every drop you see there was a frametime spike.
  3. The only thing being read at the moment of said spikes was savegame data.. This did not change before or after the spike, making the impression its either not diskload related or to small to show up.
  4. There was no queue depth on the disk in question (or any).
  5. No high interrupts on the cpu.
  6. CPU frequency didnt lower.
  7. No high CPU usage in total.
HqBpjWi.png
  1. more frametime spikes in subnautica, same area.
  2. Again some deep drops in GPU usage during the spikes.
  3. Disk reaction time in ms is close to nothing. Note again most busy is savedgames.
  4. Write disk data (not on screenshot) was fairly consistent savedgames & logfile and did not only occur during framespikes.
  5. Again no queue depth on disk.
  6. No high interrupts on cpu.
  7. No cpu frequency problem
  8. Low cpu usage in general.


I could not reproduce another issue inside a mere module this evening, resulting in frametime spikes.
It revolved around high frametimes in the last (closed) module. Halfway down the module frametime spikes, regardless of which direction you viewed/walked in.
This one needs more testing.

Comments

  • WrattsWratts The Sweet Surland Join Date: 2015-04-28 Member: 203906Members
    Well, I don't have the research to back this up, as I was figuring that my computer just might not be up to snuff, but this post has got me thinking now.

    I'm not 100% sure yet and need to test this more, but I sometimes get the impression that I have my frametime spikes happen on the borders between biomes, especially the creepvine biome.
  • ObraxisObraxis Subnautica Animator & Generalist, NS2 Person Join Date: 2004-07-24 Member: 30071Super Administrators, Forum Admins, NS1 Playtester, Forum Moderators, NS2 Developer, Constellation, NS2 Playtester, Squad Five Silver, WC 2013 - Supporter, Subnautica Developer, Pistachionauts
    calling @LumpN - this seems to be good information for him.
  • SenneraSennera Texas Join Date: 2015-07-07 Member: 206043Members
    Wratts wrote: »
    Well, I don't have the research to back this up, as I was figuring that my computer just might not be up to snuff, but this post has got me thinking now.

    I'm not 100% sure yet and need to test this more, but I sometimes get the impression that I have my frametime spikes happen on the borders between biomes, especially the creepvine biome.

    I don't remember what they're called in Subnautica, but the map is divided into a 2D grid and each box/chunk of that grid is loaded in as you near it. I find the effect most visible in the mushroom forests where the trees have a much lower detail until they load in.

    I'm guessing the game has to read data from the savefile cache to load in chunks the way you left them and that would explain why those reads are consistently accompanying the frametime spikes.

    From the looks of things, it seems like the game does not render and read the cache in parallel, so when it's reading from cache it stops rendering the game during that period.
  • DC_DarklingDC_Darkling Join Date: 2003-07-10 Member: 18068Members, Constellation, Squad Five Blue, Squad Five Silver
    The odd thing is, the read/writes are not matching the spikes.. There is the same level of read/write before and after such spikes.
    If it IS due to disk activity, the difference is just to small to measure. I mean.. look at the screens.
    If you LOAD subnautica you have higher loadtimes and queue depths then that, obviously.

    a 10ms TOPS on the entire computer in terms of disk activity is nothing.
    The savedcache is on the top of the list as it had most read activity last, but you can see in the screenshot the current activity is 0. (and as only subnautica pauses and not my 2nd screen with all the tools, I can say that number did NOT go up. (unless again, its faster then the refresh rate of the tool.. in which case the problems it causes would be nominal.)


    Right now I can only match the frametimespikes with a absense of GPU %, nothing else... Which makes it so odd.


    Part of me is glad, and part sad, I could not reproduce the tunnel module thing. Because that was even not related to view direction.

    Also I did not include any memory screenshots.
    Subnautica does not even come close to using the memory I have..
  • SenneraSennera Texas Join Date: 2015-07-07 Member: 206043Members
    The 0% GPU means that Subnautica has put rendering on hold to do something else. It's a bottleneck someplace, and I thought you were saying it was reading the cache when GPU % drops to 0 so I assumed the bottleneck was coming there.

    Pretty much, a condition is checking for something to happen before each frame renders and if that condition doesn't happen, it waits for the condition to fulfill before going back to rendering the game. This could be to make sure the rendered scene is accurate, or so that the ground doesn't disappear for a moment, or however the game's set up to work.
  • DC_DarklingDC_Darkling Join Date: 2003-07-10 Member: 18068Members, Constellation, Squad Five Blue, Squad Five Silver
    I know it, in theory, should be doing something to bottleneck.
    Its just I didn't find it yet. It does not seem to be disk, cpu or memory..

    I assume others also have frametime spikes and I hope we get a debate going to how, why, how bad and how much. (I experience loads of them in experimental build)
  • DC_DarklingDC_Darkling Join Date: 2003-07-10 Member: 18068Members, Constellation, Squad Five Blue, Squad Five Silver
    New day, new testing. Lots of screenshots.
    Due to imgur being a pain ive made some jpeg. I still got the png if needed.
    EiDamZx.png
    Minimum manual settings spikes.
    BMsxAeL.jpg
    All manual minimum except textures.. Its already a big change.
    G7CIRpt.jpg
    Manual lowest AGAIN to retest.. Nope, it still can happen.. (just less)
    q8mNdxD.jpg
    Just textures then? Sadly, no.
    SblMExX.jpg
    It gets worse even on low.
    KBvAC1a.jpg
    And on experimental for comparison.


    It cant be just mere streaming textures, although that does add to the spikes. It seems pretty much every setting adds to creating the huge frametime spikes.
    Yet the average ms time when there are no frametime spikes, do not suggest the GPU in question can not handle the load.
    It will be interesting what others have to say or compare.
  • DC_DarklingDC_Darkling Join Date: 2003-07-10 Member: 18068Members, Constellation, Squad Five Blue, Squad Five Silver
    edited July 2015
    Out of nothing subnautica suddenly went from frametime spikes to frametime walls.

    As shown on the shot below frametimes suddenly went up like nothing in safe shallows. For the screens (and for testing), graphics have been lowered. (I usually play on higher.)
    Again nothing odd to see. All hardware usage seems fine.
    DDoHz26.jpg

    Moving a VERY SLIGHT bit to the left made frametimes plummit back to normal. At the moment of taking these picture I could reproduce this constant. (I will try again in a few min.)
    The framespike on making a screenshot is... rather odd. To my knowledge that does not get paged to disk, so why would it affect frametime like it did.. (I will look into that more.)
    Lg3FRul.jpg



    EDIT BELOW.

    Ok so it proved to not be memory.. While most was reserved at the time due to ns2 and stuff, cleaning up reserved memory did... nothing for subnautica at all.
    printscreens in fact do go to disk, so.. what about the disk?
    Of course the screenshot shows but a fraction of the capture.

    Its rather amazing (and quite saddening) that such disk times affect subnautica.
    It will be interesting to see how it does on SSD. To be continued.
    WG7wB0h.jpg


    EDIT AGAIN.

    Moving to SSD did nothing. As the latency times already are QUITE low, it did not matter. (it was on a hybrid before.)
    Still the frame issues correspond (at the moment) to the saved game stuff as shown in the earlier screenshot.

    Which makes me wonder, what is subnautica DOING in those saves. The shear number of them, how often.. damn.


    AND ANOTHER EDIT.
    Ramdisking the above did nothing to add to performance.
  • IronHorseIronHorse Developer, QA Manager, Technical Support & contributor Join Date: 2010-05-08 Member: 71669Members, Super Administrators, Forum Admins, Forum Moderators, NS2 Developer, NS2 Playtester, Squad Five Blue, Subnautica Playtester, Subnautica PT Lead, Pistachionauts
    edited July 2015
    This is really great data @DC_Darkling and narrows the issue down for the devs. Thanks!
    Pinging @Max and @LumpN to take a look at the leg work you've done


    I know it, in theory, should be doing something to bottleneck.
    Its just I didn't find it yet. It does not seem to be disk, cpu or memory..

    I assume others also have frametime spikes and I hope we get a debate going to how, why, how bad and how much. (I experience loads of them in experimental build)
    I've been suspecting SN not running in exclusive full screen to be the cause, since your system has to juggle the OS and everything with it when in windowed mode.
    Could maybe explain why the culprit cannot be found tied to SN's use.

    When profiling with process explorer can you see if there are system related operations that coincide with these spikes?
  • DC_DarklingDC_Darkling Join Date: 2003-07-10 Member: 18068Members, Constellation, Squad Five Blue, Squad Five Silver
    edited July 2015
    After testing not just outside the door of my base, but many cave and kelp I can add more to this list.

    steamapps\common\Subnautica\Subnautica_Data\output_log.txt
    Also seems to be occurring during spikes.

    \AppData\Local\Temp\NVIDIA Corporation\NV_Cache\d0ee50f82000f8b25561e549f5f1b458_fce8395f8fd8a84b_1c88e0f63d23348e_0_0.bin
    nvidia's shader caching also occurs, but much more rare.

    While many a frametime wall occurs with savedgames, it seems this is NOT consisteny across the map. (although still quite often)


    Like previously posted.. it seems to not occur with any system or OS action or process, unless directly linked to subnautica.
    If there is such a process or action, I havent found it yet.. System usage across the board remains quite minimal.


    To be clear incase it was missed.
    I only ramdisked the savedgames folder as that pretty much was the only thing eating disktime.
  • DC_DarklingDC_Darkling Join Date: 2003-07-10 Member: 18068Members, Constellation, Squad Five Blue, Squad Five Silver
    edited July 2015
    New day, new ideas.

    Ok so hardware wise its becoming a mystery. CPU seems fine, GPU seems fine, mem seems fine and even disk usage seems ok. Not much left.
    So I decided to check handles and threads. Not much differs in between the issues and when subnautica runs normal, but I did notice something else.. on the matter of threads.

    Sadly I do not have subnautica symbols, so below may be 'off'.


    The first batch shows the threads and their corresponding cpu usage while frametimes are being crap or worse.
    FEcuKnO.jpg
    ONAZ7D5.jpg
    sLvoZOm.jpg
    fIcywlE.jpg

    The last one shows the situation when frametimes are within acceptable limits.
    cdLTuGX.jpg


    I do not fully trust the info I got when I looked into the stack (due to stuff like symbols).
    But I did see some stuff about disks.. but the disk is not that busy.. and ramdisking the folder for saves did nothing... hmm..

    obviously results might also be slightly skewed due to human reaction time. (aka me pressing printscreen.) But they seem okish.
  • Soul_RiderSoul_Rider Mod Bean Join Date: 2004-06-19 Member: 29388Members, Constellation, Squad Five Blue
    edited July 2015
    I would guess, from my own experiences with Unity that you'll probably find some form of Garbage Collection happening.

    It seems the most logical fit to the drops in usage (because stuff is being cleared), and lack of rendering. CPU being higher makes sense as it is doing the job of the garbage collection.

    I may be wrong, but I would certainly investigate that area first.

    I really hope when DX12 comes out that Unity supports it. It's an engine that could definitely benefit from the supposed improvements of DX12.
  • DC_DarklingDC_Darkling Join Date: 2003-07-10 Member: 18068Members, Constellation, Squad Five Blue, Squad Five Silver
    I would not call cpu higher tbh.. The usage difference on cpu is so extreme minimal.
    But you may be onto something.

    Thats for the devs to find out aye? At this point I dont think its anything I can boost client side.
  • Racer1Racer1 Join Date: 2002-11-22 Member: 9615Members
    Is there a (console) command to log when Unity is doing GC?
  • LumpNLumpN Join Date: 2002-10-30 Member: 1725Members, Subnautica Developer
    Subnautica is doing a lot of disk reads and writes pretty much all the time when moving through the world. It loads in new chunks and saves out old chunks of terrain and entities. This by itself might be fairly terrible for non-SSD HDDs but it's certainly worsened by the fact that you're running a virus scanner that is configured to scan everything. The virus scanner locks every single file we request and keeps it locked for a couple of milliseconds before we get access. In the meantime Subnautica can not do anything but wait. That's why you see GPU and CPU usage drop.
  • DC_DarklingDC_Darkling Join Date: 2003-07-10 Member: 18068Members, Constellation, Squad Five Blue, Squad Five Silver
    edited July 2015
    Hmmm.. I was sure I whitelisted it..
    if I forgot its obviously blatantly stupid, from a testing perspective.


    EDIT.

    Ok you seem to be correct and not correct. Lets picture up shall we. :)

    Apparently I did NOT yet whitelist the folder in my AV. Truthfully it shouldnt be a big problem after release. most AV 'remember' files which are not changed.. Nontheless, its whitelisted.
    So.. how does it behave now?

    global disk latency is indeed down compared to previous shots (although those were also from my hyrbid disk and currently subnautica is on SSD.)



    you can again see subnautica frametimes hit a wall. You can see the system accessing files from disk (the ssd), which is probably all the loading you described. Unlike earlier, the AV executable is gone from the list. (and yes, im still slapping myself for not noticing.)
    H9ZB8ZU.jpg

    In the second picture frametimes are still hitting a wall.. I basicly sat and waited, and waited. Eventually subnautica is completely done loading, its disk activity has been on 0% for a short while. But frametimes are not increasing.
    mO11ejG.jpg


    EDIT 2.
    I checked some more areas.
    remaining frametime spikes (and the frametimewall near base) do not correspond to disk usage.
    Many areas have higher disk usage and completely fine frames.

    spikes HAVE lessened!
    So the AV was holding parts of it back. :)
  • IronHorseIronHorse Developer, QA Manager, Technical Support & contributor Join Date: 2010-05-08 Member: 71669Members, Super Administrators, Forum Admins, Forum Moderators, NS2 Developer, NS2 Playtester, Squad Five Blue, Subnautica Playtester, Subnautica PT Lead, Pistachionauts
    edited July 2015
    Look at what I found... https://forums.geforce.com/default/topic/852328/3d-vision/vapour/post/4593980/#4593980

    You can run Subnautica in exclusive fullscreen mode with that ^

    Check out the frame times.. the frametime walls are still there, but the frametimes are seemingly better (FPS sure is!)

    EDIT: SN should be digitally signed so AV does not interfere
  • IronHorseIronHorse Developer, QA Manager, Technical Support & contributor Join Date: 2010-05-08 Member: 71669Members, Super Administrators, Forum Admins, Forum Moderators, NS2 Developer, NS2 Playtester, Squad Five Blue, Subnautica Playtester, Subnautica PT Lead, Pistachionauts
    Update: using that tool I linked + forcing Nvidia to apply Vsync, I was able to get much better frametimes.
    The frametime walls were still there however. (despite AV excluding Steam folder and being turned off)

    I realize this is sort of cheating since it's buffering frames, but hey it's way more playable in forced fullscreen + forced Vsync in the meantime..
    Odd that the constant stuttering is definitely still there, though, even if it is reduced..
  • DC_DarklingDC_Darkling Join Date: 2003-07-10 Member: 18068Members, Constellation, Squad Five Blue, Squad Five Silver
    I haven't (yet) tried the tool, but yes. I already did mess with buffers and vsync... as much as windowed would allow me.
    More buffers isnt a real problem for subnautica I think. Input lag is less a issue in this game.

    But yes, its not a fix.. it just reduces the problem.
  • DC_DarklingDC_Darkling Join Date: 2003-07-10 Member: 18068Members, Constellation, Squad Five Blue, Squad Five Silver
    Latest experimental build.
    New game. (because due to the world changes the game advised me to start over.)

    frametime spikes have lessened greatly. Both duration and occurrence.
    frametime walls (for now) seem gone.

    Its not perfect yet, but its a lot better then it was.
  • IronHorseIronHorse Developer, QA Manager, Technical Support & contributor Join Date: 2010-05-08 Member: 71669Members, Super Administrators, Forum Admins, Forum Moderators, NS2 Developer, NS2 Playtester, Squad Five Blue, Subnautica Playtester, Subnautica PT Lead, Pistachionauts
    There's also a console command you can use to force Vsync since the Nvidia control panel can't seem to do it.
    Just type VSYNC in the console.

    Now if there was only a way to render ahead, as well..
  • GreenWitcher1GreenWitcher1 Your Face Join Date: 2016-04-21 Member: 216026Members
    IronHorse wrote: »
    Look at what I found... https://forums.geforce.com/default/topic/852328/3d-vision/vapour/post/4593980/#4593980

    You can run Subnautica in exclusive fullscreen mode with that ^

    Check out the frame times.. the frametime walls are still there, but the frametimes are seemingly better (FPS sure is!)

    EDIT: SN should be digitally signed so AV does not interfere

    I tried the fix, and it runs the game in exclusive fullscreen, but when the game loads the main menu is frozen and I can't click on anything. I end up having to close the game via task manager. Not sure how you got it in-game since mine freezes at the main menu. Did you edit something in the config file?

Sign In or Register to comment.