Linux concurrency and competition Before talking about Linux concurrent operations, let’s first understand the difference between concurrency and parallelism. Both terms refer to multiple operations being executed at the same time. However, these two concepts are very different, and they are often confused. Concurrency emphasizes that there can only be one object that performs multiple […]
Tag: concurrency
Redis principles cache expiration, consistent hashing, avalanche, penetration, concurrency, blooming, cache update strategy, cache database consistency
redis expiration policy The expiration policy of redis can be configured through the configuration file 1. Regular deletion Redis will put the keys with expiration time set in a separate dictionary, and periodically traverse to delete the expired keys. 1). Randomly select 20 keys from the expired dictionary every 100ms and delete the expired keys; […]
How to successfully design a high-concurrency Java flash killing system
When designing a highly concurrent Java flash killing system, you need to consider the following aspects: Database Optimization: Use a high-performance database, such as Redis or Memcached, to store data such as inventory information of flash sale items in memory to improve read and write performance. Caching technology: Use caching technology to reduce the pressure […]
Buffer channel and limit the number of goroutine concurrency
Article directory 3.7.1 Used as counting semaphore 3.7.2 Use cache channel + sync.WaitGroup to limit the number of concurrencies (similar to the previous section) To limit the concurrency of goroutine, Be sure to block the main goroutine! Be sure to block the main goroutine! Be sure to block the main goroutine! See the last example. […]
Java NIO high concurrency development
Java NIO high concurrency development Foreword Compared with traditional Java I/O (BIO), Java NIO (New I/O) has the following advantages in high-concurrency development: Non-blocking mode: Java NIO uses non-blocking I/O operations, allowing one thread to manage multiple channels (Channel), and will not block the thread when there is no data to read or write. This […]
Multi-thread concurrency in python
Foreword Today, I want to talk to you about multi-threaded concurrency in Python. Without further ado, let’s get straight to the topic. 1. Thread execution Python’s built-in modules provide two built-in modules: thread and threading. Thread is a source module and threading is an extension module. It is encapsulated and improved on the basis of […]
Use Hystrix to implement request merging and reduce server concurrency pressure
1. Introduce Hystrix <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-hystrix</artifactId> </dependency> 2. Enable Hystrix function on the startup class @EnableHystrix 3. Request to merge the implementation code import com.bzcst.bop.oms.orm.model.po.Product; import com.bzcst.bop.oms.orm.service.ProductService; import com.netflix.hystrix.contrib.javanica.annotation.HystrixCollapser; import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand; import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty; import com.netflix.hystrix.contrib.javanica.conf.HystrixPropertiesManager; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; import java.util.concurrent.Future; /** * @author Xiang Zhenhua * @date 2023/10/26 14:37 */ […]
SpringBoot + Disruptor implements extremely fast and high-concurrency processing, supporting 6 million orders per second without any pressure!
1Background I encountered a project at work that used Disruptor as a message queue. You read that right, it is not Kafka or rabbitmq. The biggest advantage of Disruptor is that it is fast, and it is open source. Let’s make a simple record. 2Disruptor introduction Disruptor is a high-performance queue developed by LMAX, a […]
HarmonyOS multi-audio playback concurrency policy and audio management analysis
Audio interruption strategy Multi-audio concurrency, that is, multiple audio streams are played at the same time. In this scenario, if the system is not controlled, multiple audio streams will be mixed and played, which will easily make users feel noisy and cause a bad user experience. In order to solve this problem, the system presets […]
Concurrency tool class for Java threads
Concurrency utility class for Java threads. 1. fork/join 1. Fork-Join principle If necessary, split (fork) a large task into several small tasks, and then summarize (join) the results of each small task. Applicable scenarios: large data volume statistical tasks. 2. Job theft In the implementation of Fork/Join, small tasks split from large tasks will be […]