Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit database from taking all the threads #2261

Merged
merged 8 commits into from
Sep 8, 2019

Conversation

Mag-nus
Copy link
Member

@Mag-nus Mag-nus commented Aug 20, 2019

This adds limits to the database thread consumption.

It also should allow the world to now consume threads easier.

The way it is done is as follows.

  • We determine the number of available threads using Environment.ProcessCount
  • We allocate (int)Math.Max(Environment.ProcessorCount * .34, 1) to the World, and the remainder tothe database.

It breaks down as follows
1 vCPU = ACE will not start
2 vCPU = 1 thread world, 1 thread database
3 vCPU = 1 thread world, 2 thread database
4 vCPU = 1 thread world, 3 thread database
5 vCPU = 1 thread world, 4 thread database
6 vCPU = 2 thread world, 4 thread database
7 vCPU = 2 thread world, 5 thread database
8 vCPU = 2 thread world, 6 thread database
9 vCPU = 3 thread world, 6 thread database
10 vCPU = 3 thread world, 7 thread database
11 vCPU = 3 thread world, 8 thread database
12 vCPU = 4 thread world, 8 thread database

I'd like to get some feedback from this PR on various sized servers.

What you may notice is that loading a player may take slightly longer (very slightly).

What you will probably notice is no discernible difference in-game.

What I want to make sure happens is that the world doesn't end up feeling more choppy due to the parallel processing of outbound network traffic. Hopefully the more fair thread distribution will help prevent thread starvation.

This adds limits to the database thread consumption.

It also should allow the world to now consume threads easier.

The way it is done is as follows.

- We determine the number of available threads using Environment.ProcessCount
- We allocate (int)Math.Max(Environment.ProcessorCount * .34, 1) to the World, and the remainder tothe database.

It breaks down as follows
1 vCPU = 1 thread world, 1 thread database
2 vCPU = 1 thread world, 1 thread database
3 vCPU = 1 thread world, 2 thread database
4 vCPU = 1 thread world, 3 thread database
5 vCPU = 1 thread world, 4 thread database
6 vCPU = 2 thread world, 4 thread database
7 vCPU = 2 thread world, 5 thread database
8 vCPU = 2 thread world, 6 thread database
9 vCPU = 3 thread world, 6 thread database
10 vCPU = 3 thread world, 7 thread database

I'd like to get some feedback from this PR on various sized servers.

What you may notice is that loading a player may take slightly longer (very slightly).

What you will probably notice is no discenerable difference in-game.

What I want to make sure happens is that the world doesn't end up feeling more choppy due to the parallel processing of outbound network traffic. Hopefully the more fair thread distriubiton will help prevent thread starvation.
@Mag-nus
Copy link
Member Author

Mag-nus commented Aug 22, 2019

So far results have been positive.

@ghost
Copy link

ghost commented Aug 25, 2019

Been using this PR on my local server since about the time it was posted and have not experienced any ill effects.

Copy link
Member

@LtRipley36706 LtRipley36706 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to support even those computers that have 1 cpu

@Mag-nus
Copy link
Member Author

Mag-nus commented Sep 6, 2019

Need to support even those computers that have 1 cpu

That's just not realistic. For example, let's say you want to load a player on a 1 CPU system. Loading the player and all of their inventory might take 1s - 5s. During that time, the entire world will be frozen. Every time a player saves, the entire world will be frozen.

Any time a new player logs in, the entire world will be frozen.

1 cpu is just not a realistic environment that can run ACE.

@Mag-nus Mag-nus merged commit 1d905bc into ACEmulator:master Sep 8, 2019
@Mag-nus Mag-nus deleted the ThreadLimits branch September 8, 2019 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants