MySQL database implements master-master synchronization

Foreword MySQL master-master synchronization actually promotes slave database to master database on the basis of master-slave synchronization, so that they can read and write databases with each other, and slave database becomes master Database; the process of master-slave mutual authorization connection, reading the binlog log of the other party and updating it to the local […]

Passing thread id between MDC and asynchronous multithreading of logs

Article directory 1 MDC 1.1 Introduction 1.2 MDC coordinates and use 1.3 Main method 2 Use between multiple threads 2.1 MDC Tools 2.2 Interceptor definition and configuration 2.3 Use in Java thread pool 2.3.1 Configure thread pool 2.3.2 Using ExecutorCompletionService 2.3.3 Using CompletableFuture 2.4 Use in Spring thread pool 2.4.1 Inherit ThreadPoolTaskExecutor 2.4.2 Configure thread […]

asio(12), asynchronous tcp, udp server

Official website tutorial: https://think-async.com/Asio/asio-1.26.0/doc/asio/tutorial/tutdaytime7.html asio asynchronous tcp, udp server int main() {<!– –> try {<!– –> asio::io_context io_context; We will first create a server object to accept TCP client connections. tcp_server server1(io_context); We also need a server object to accept UDP client requests. udp_server server2(io_context); We’ve created two io_context objects that do a lot of […]

CompleteFuture failed to execute asynchronously but returned success

CompleteFuture failed to execute asynchronously but returned success 1. Custom thread pool @Configuration public class ThreadPoolConfig {<!– –> public static ThreadPoolExecutor getThreadPoolExecutor() {<!– –> int availableProcessors = Runtime.getRuntime().availableProcessors(); return new ThreadPoolExecutor( availableProcessors, availableProcessors, 0L, TimeUnit. MILLISECONDS, new LinkedBlockingQueue<>(9999), new ThreadFactoryBuilder().setNameFormat(“thread-pool-%d”).build(), new ThreadPoolExecutor. CallerRunsPolicy()); } } Write three simple asynchronous tasks and create an exception when […]

[c++] Asynchronous print service log

Advantages of asynchronously printing logs Log service is a common background service, which usually requires a lot of log output to record various operations and events. During the running of the service, frequently outputting log information will bring a certain performance overhead, reduce the throughput and response speed of the service, and may even cause […]

Spring asynchronous annotation @Async

Spring provides the @Async asynchronous annotation, which can be marked on a method to call the method asynchronously. @Target({ElementType. TYPE, ElementType. METHOD}) @Retention(RetentionPolicy. RUNTIME) @Documented public @interface Async { /** * A qualifier value for the specified asynchronous operation(s). * <p>May be used to determine the target executor to be used when executing * the […]

Springboot custom ThreadPoolTaskExecutor thread pool multi-threaded concurrent execution of asynchronous methods

1. Background Currently, due to work requirements, a large number of Http requests need to be sent. After practice, it takes 6 hours to complete the traversal and sending. If a single-threaded request is sent, the main thread will be blocked. There will be the following problems: The front-end user waits too long for a […]

Java-Concurrency-21-Eight ways to achieve asynchrony

In actual development, many business scenarios need to use asynchrony, so the following eight common asynchronous methods are listed below Asynchronous mode 1: Thread public class AsyncThread extends Thread {<!– –> @Override public void run() {<!– –> try {<!– –> Thread. sleep(3000); } catch (InterruptedException e) {<!– –> throw new RuntimeException(e); } System.out.println(“3333333333333333333”); } public […]

Python’s various network request libraries urllib3 requests aiohttp request http and https efficiency comparison, multi-threading, gevent, asyncio comparison, super large thread pool, 2n + 1 thread pool comparison…

The three purposes of this article are not to go astray by just obsessing with concepts. Some people think that there is a set of concepts, but in fact it is not what they think. This article uses various network request libraries, various concurrency modes, and thread pools of various sizes to test 50,000 requests […]