Home > Back-end >  High concurrency scenarios (user) more, how to use the multithreading? How can ability let efficienc
High concurrency scenarios (user) more, how to use the multithreading? How can ability let efficienc

Time:12-06

Is like this:
If say I now have a lot of people at the same time on my website,
I want to make high efficiency at the same time,
So could you please tell me in as far as possible with less computer case,
Should use what kind of lock, what kind of structure to manage individual threads?
Hope to have a great god can give some ideas ~ ~ ~
Can also give some example ~ ~ ~

CodePudding user response:

This time with the content of the data in redis persistence and distributed lock, by redis data persistence, will cache the data saved to the local, using redis distributed lock, control data security issues, on high availability, to be implemented using redis cluster, redis cluster rediscluster technique was used to realize, so that you can realize that all the requirements,

CodePudding user response:

refer to 1st floor met the goddess response:
this time with the content of the data in redis persistence and distributed lock, by redis data persistence, will cache the data saved to the local, using redis distributed lock, control data security issues, on high availability, to be implemented using redis cluster, redis cluster rediscluster technique was used to realize, so that you can realize that all the requirements,

Emmmm...
This is a c + +?
If so, could you tell me which header files to use?
Or which database to download?

CodePudding user response:

refer to 1st floor met the goddess response:
this time with the content of the data in redis persistence and distributed lock, by redis data persistence, will cache the data saved to the local, using redis distributed lock, control data security issues, on high availability, to be implemented using redis cluster, redis cluster rediscluster technique was used to realize, so that you can realize that all the requirements,

Is there a small example about these aspects?

CodePudding user response:

Completion port + thread pool, at present the most efficient communication model, no one,,

But the high concurrency is a whole system, a technology alone won't work,

Front, the use of reverse proxy, separate the static and dynamic data request data, static request is images, code, UI, such as static data, dynamic request is need to calculate to know the result, the static request directly from the static server returns results can, for dynamic requests, and then to load balance, will request distribution to calculate server, the server using the completion port + the communication model of thread pool, of course, completion port supports Windows only, if not Windows, consider the language and so on,,,,

CodePudding user response:

The
reference 4 floor sdhexu reply:
completion port + thread pool, at present the most efficient communication model, no one,,

But the high concurrency is a whole system, a technology alone won't work,

Front, the use of reverse proxy, separate the static and dynamic data request data, static request is images, code, UI, such as static data, dynamic request is need to calculate to know the result, the static request directly from the static server returns results can, for dynamic requests, and then to load balance, will request distribution to calculate server, the server using the completion port + the communication model of thread pool, of course, completion port supports Windows only, if not Windows, consider the language and so on,,,,

So, what are the main thread pool?

CodePudding user response:

reference 5 floor abcd7038 reply:
Quote: refer to 4th floor sdhexu response:
add multiple threads to create ahead of schedule, when to use directly pushed the tasks performed in the past, avoid creating and releasing the overhead of thread resources

CodePudding user response:

reference 5 floor abcd7038 reply:
Quote: refer to 4th floor sdhexu response:

Completion port + thread pool, at present the most efficient communication model, no one,,

But the high concurrency is a whole system, a technology alone won't work,

Front, the use of reverse proxy, separate the static and dynamic data request data, static request is images, code, UI, such as static data, dynamic request is need to calculate to know the result, the static request directly from the static server returns results can, for dynamic requests, and then to load balance, will request distribution to calculate server, the server using the completion port + the communication model of thread pool, of course, completion port supports Windows only, if not Windows, consider the language and so on,,,,

So, what are the main thread pool?


The meaning of the thread pool is: first you have to understand A truth, for A CPU (single), at the same time can only run one thread, you just look so many programs run together, it is because he has carried on the time-sharing processing, that is to say running thread A period of time, and then to protect the good scene, in the running thread B for A period of time, to switch back and forth between the different threads, makes you feel like you A lot of threads run at the same time, and when you thread number reaches A certain threshold, the need to switch back and forth between threads, is larger than the thread work time, means that the CPU busy protection thread is light, restore field operations, such as light busy thread switches, less time to do something, the overall efficiency will decline, instead,
Then the thread pool is in order to solve the above problem, in general, a CPU can run 2-3 threads, so what is your CPU nuclear, or do you have a few CPU, then you can create in advance good CPU number * 2 ~ 3 thread, the number of these threads according to the number of CPU cores and CPU, adjust to the best state, when has a task to deal with, wake up one thread from the thread pool, to carry out your tasks, after the completion of the task, the thread will sleep, get back in the thread pool,,
This efficiency is high,

The use of thread pool: https://blog.csdn.net/sdhexu/article/details/38020861

CodePudding user response:

refer to 7th floor sdhexu response:
Quote: refer to the fifth floor abcd7038 reply:
Quote: refer to 4th floor sdhexu response:

Completion port + thread pool, at present the most efficient communication model, no one,,

But the high concurrency is a whole system, a technology alone won't work,

Front, the use of reverse proxy, separate the static and dynamic data request data, static request is images, code, UI, such as static data, dynamic request is need to calculate to know the result, the static request directly from the static server returns results can, for dynamic requests, and then to load balance, will request distribution to calculate server, the server using the completion port + the communication model of thread pool, of course, completion port supports Windows only, if not Windows, consider the language and so on,,,,

So, what are the main thread pool?


The meaning of the thread pool is: first you have to understand A truth, for A CPU (single), at the same time can only run one thread, you just look so many programs run together, it is because he has carried on the time-sharing processing, that is to say running thread A period of time, and then to protect the good scene, in the running thread B for A period of time, to switch back and forth between the different threads, makes you feel like you A lot of threads run at the same time, and when you thread number reaches A certain threshold, the need to switch back and forth between threads, is larger than the thread work time, means that the CPU busy protection thread is light, restore field operations, such as light busy thread switches, less time to do something, the overall efficiency will decline, instead,
Then the thread pool is in order to solve the above problem, in general, a CPU can run 2-3 threads, so what is your CPU nuclear, or do you have a few CPU, then you can create in advance good CPU number * 2 ~ 3 thread, the number of these threads according to the number of CPU cores and CPU, adjust to the best state, when has a task to deal with, wake up one thread from the thread pool, to carry out your tasks, after the completion of the task, the thread will sleep, get back in the thread pool,,
This efficiency is high,

The use of thread pool: https://blog.csdn.net/sdhexu/article/details/38020861

You this should be a Java or other languages, some c + + can consult?

CodePudding user response:

This is a c + +

CodePudding user response:

This is a big topic
  • Related