Analysis and application of connection pool in Python

Connection Pool (Connection Pool) stores network connections as objects in memory during system initialization. When the user needs to connect, an established empty connection object is taken from the connection pool and the connection is not closed after use. , put the connection back into the connection pool without having to frequently create and close […]

C++ uses thread pool to simulate asynchronous event processing mechanism

There are asynchronous event processing mechanisms in many C++ frameworks, which makes us often confused and difficult to understand when looking at the source code. The programming routines contained in it may be some mature technologies that we are not familiar with, such as WebRTC. It is similar to Qt’s signal and slot mechanism, thread […]

Java thread pool – Executor framework

Article directory 1. Executor interface 2. ExecutorService interface 3. ThreadPoolExecutor class 1. Status 2. Worker 3. Extension 4. ForkJoinPool class 1. Work stealing algorithm 2. Fork/Join design 3. Execution principle 5. ScheduledThreadPool class 1.ScheduledExecutorService 2. Compare Timer 6. Executors class The Executor framework was introduced after Java 5. After Java 5, starting threads through Executor […]

Spring’s own thread pool ThreadPoolTaskExecutor

Spring default thread pool simpleAsyncTaskExecutor The interface class of Spring asynchronous thread pool is TaskExecutor, which is essentially java.util.concurrent.Executor. If there is no configuration, simpleAsyncTaskExecutor is used by default. @Async demonstrates Spring’s default simpleAsyncTaskExecutor @Component @EnableAsync public class ScheduleTask {<!– –> SimpleDateFormat sdf = new SimpleDateFormat(“yyyy-MM-dd HH:mm:ss”); @Async @Scheduled(fixedRate = 2000) public void testScheduleTask() {<!– […]

pgpool-II + keepalived achieves high availability

Installation Download https://pgpool.net/mediawiki/index.php/Downloads Compile and install tar -zxvf pgpool-II-4.4.4.tar.gz cd pgpool-II-4.4.4.tar.gz ./configure –prefix=/usr/local/pgpool –with-pgsql=/usr/local/postgres/ make & amp; & amp; make install #pgpool-regclass plug-in installation cd /root/pgpool-II-4.4.4/src/sql/pgpool-regclass make & amp; & amp; make install psql -h /data/pgdata/tmp -p 4567 -U postgres -f pgpool-regclass.sql template1 # The following test is not executed ln -s /root/pgpool-II-4.4.4//src/sql/pgpool-regclass/* /usr/local/postgres/lib/ # […]

How to enable threads and thread pools in Python

1. Obtaining the optimal number of threads: 1. Carry out performance stress testing by slowly increasing the number of users, and observe QPS (that is, the number of response requests per second, that is, the maximum throughput capacity.), and response time. 2. Calculate according to the formula: The optimal number of threads on the server […]