Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
1
Question by BlackOverlord · Mar 27, 2019 at 08:02 PM · linuxthreadsglobal illuminationbatchmodeheadless

Unity creates too many threads

We use headless linux build (running in batchmode) for our dedicated servers and we launch multiple application instances on each of our server machines. But we encountered a problem that each process creates too many threads which seem unnecessary. It looks as if number of threads depends on the number of logical cores of the running machine. For example on 1-core VM it creates 30 threads, on 4-core - 37 threads, on 36-core production machine - 99 threads. On my windows machine with 12 cores - 60 threads. So the problem not only for linux builds.

There is another worrying notice, but I'm not sure if it's connected to the threads issue: more than half of CPU time is consumed by system calls and strace shows following results (for a 20 seconds interval):

% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 99.59    3.971471          38    105655           futex
  0.21    0.008423          23       366           stat
  0.15    0.006040          33       185           sendto
  0.03    0.001224          26        47        47 accept
  0.01    0.000269         269         1           restart_syscall
  0.00    0.000198           8        24        12 write
  0.00    0.000059           5        12           lseek
  0.00    0.000000           0         1           clone
  0.00    0.000000           0         2           uname
------ ----------- ----------- --------- --------- ----------------
100.00    3.987684                106293        59 total

We tried following things:

  1. Disabling development mode

  2. Setting "Realtime Global Illumination CPU usage" in graphics settings to low

  3. Disabling GI for each scene by setting "m_EnableRealtimeLightmaps", "m_EnableBakedLightmaps", "m_AlbedoBoost" to 0 and "m_GIWorkflowMode" to 1 in scene files

  4. Setting CPU affinity to a single core using either taskset utility and sched_setaffinity system call

    Nothing seems to have any effect on amount of threads. We use Unity 2018.2.12f1 but we also tried 2018.3.8f1

Is there a way to reduce number of threads unity creates and therefore decrease corresponding overhead?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Captain_Pineapple · Jan 31, 2020 at 10:35 AM 0
Share

Did you find a solution to this? I'm currently facing the exact same issue... 25-30 threads per game instance....

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by LarsGameloft · Nov 02, 2020 at 10:10 PM

Did you get an answer for this? I am having an issue where my app creates more threads than allowed by the hardware. Thank you

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

178 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Server-side rendering with no display 0 Answers

Cache Server in Batchmode 1 Answer

Linux Standalone player can not find GPU 1 Answer

how to enable graphics device in batchmode 1 Answer

FixedUpdate logic step by step 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges