Search Unity

Worker Thread management

Discussion in 'Entity Component System' started by Knightmore, Feb 12, 2019.

  1. Knightmore

    Knightmore

    Joined:
    May 11, 2012
    Posts:
    227
    Hey there,
    I am trying the whole ECS/Job System package for a while now and as I am progressing, I hit some limitations which are.. well a little bit annoying while building my own networking layer on top of it.

    For now I am creating an independent thread for my network I/O - rest is jobified - and I would like to run two headless standalone instances on my testmachine (4c/8T) but as unity has no settings to limit core-use per instance, I would need a solution to limit it some other way.

    Any battle-tested suggestions?

    I have already opened a suggestions towards ECS/Job system under Feedback (https://feedback.unity3d.com/suggestions/thread-management-ecs-slash-job-system) but even if they implement anything, a transitional solution would be neat.
     
  2. Deleted User

    Deleted User

    Guest

  3. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    We are adding API's to limit the worker thread count at runtime and via command line.
     
  4. nxrighthere

    nxrighthere

    Joined:
    Mar 2, 2014
    Posts:
    567
    @Joachim_Ante Any news regarding this? It's a publishing blocker for us since worker threads with custom ones lead to oversubscription.
     
    Srokaaa, elcionap and Knightmore like this.
  5. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    API to control worker thread count is part of 19.3
     
  6. Deleted User

    Deleted User

    Guest

    Any updates?

    EDIT: Unity.Jobs.LowLevel.Unsafe.JobsUtility.JobWorkerCount has been added. Thank you.
     
    Last edited by a moderator: Dec 14, 2019
    elcionap likes this.
  7. Vincenzo

    Vincenzo

    Joined:
    Feb 29, 2012
    Posts:
    146
    @Joachim_Ante
    Can we please have this backported to 2018.4 LTS?
    2019.4 LTS is proving to be a unstable and we want to release our game.
    We have 32 core servers and every unity instance is spawning 64 job worker threads. This is a big problem for us.
    The thread contention is insane.

    Maybe any other suggestions? how does Unity detect the CPU logical core count? can I spoof it?
    Should I try to hack the Unity binary with IDA pro to get this fixed? please advice, I am at a loss here.