Deploy and test clusters in Rancher
1. In Rancher, clone the existing Docker container channel-pub-api-prev is channel-pub-api-prev-1, channel-pub-api-prev-2, as shown in Figure 1
2. The final 3 containers form a cluster, as shown in Figure 2
3. In the load balancing, add service rules and set the mapping relationship between the domain name and the target container, as shown in Figure 3
4. 2 requests are executed in postman, the first time is GET, the second time is POST, and finally there is a get request log in the container channel-pub-api-prev, in the container There is a POST request log in channel-pub-api-prev-1, there is no request log in the container channel-pub-api-prev-2, and the load balancing setting is as expected, as shown in Figure 4
5. In the 3 containers, the queue is based on the supervisor. In the service called by the queue, the output log is to the file, and finally the container channel-pub-api-prev There is a service log that indicates that the queue job is executed in the container channel-pub-api-prev. as shown in Figure 5
6. Check the Redis lock logs under the command line, not only to determine whether the lock of the Redis model exists (existing), but also the log that fails when the lock implementation of the Redis model is implemented. Time: 14:58 – 14:50 = 9 minutes. Number of locks: 29 + 31 + 10 = 70 . Lock frequency: 70 / 9 = 8, that is, 8 times per minute. as shown in Figure 6
[root@7edbf272f55f logs]# ls -ltr
total 136
-rw-r--r-- 1 root root 16556 Mar 4 14:50 app.log
-rw-r--r-- 1 root root 1 Mar 4 14:51 qq-cw-transaction-article-sync-lock-2-1583304715.txt
-rw-r--r-- 1 root root 1 Mar 4 14:54 qq-cw-transaction-article-sync-is-lock-exist-2-1583304842.txt
-rw-r--r-- 1 root root 1 Mar 4 14:54 qq-cw-transaction-article-sync-is-lock-exist-2-1583304846.txt
-rw-r--r-- 1 root root 1 Mar 4 14:54 qq-cw-transaction-article-sync-is-lock-exist-2-1583304851.txt
-rw-r--r-- 1 root root 1 Mar 4 14:54 qq-cw-transaction-article-sync-is-lock-exist-2-1583304855.txt
-rw-r--r-- 1 root root 1 Mar 4 14:54 qq-cw-transaction-article-sync-is-lock-exist-2-1583304859.txt
-rw-r--r-- 1 root root 1 Mar 4 14:54 qq-cw-transaction-article-sync-is-lock-exist-2-1583304863.txt
-rw-r--r-- 1 root root 1 Mar 4 14:54 qq-cw-transaction-article-sync-is-lock-exist-2-1583304868.txt
-rw-r--r-- 1 root root 1 Mar 4 14:54 qq-cw-transaction-article-sync-is-lock-exist-2-1583304872.txt
-rw-r--r-- 1 root root 1 Mar 4 14:54 qq-cw-transaction-article-sync-is-lock-exist-2-1583304876.txt
-rw-r--r-- 1 root root 1 Mar 4 14:54 qq-cw-transaction-article-sync-is-lock-exist-2-1583304880.txt
-rw-r--r-- 1 root root 1 Mar 4 14:54 qq-cw-transaction-article-sync-is-lock-exist-2-1583304885.txt
-rw-r--r-- 1 root root 1 Mar 4 14:54 qq-cw-transaction-article-sync-is-lock-exist-2-1583304889.txt
-rw-r--r-- 1 root root 1 Mar 4 14:54 qq-cw-transaction-article-sync-is-lock-exist-2-1583304893.txt
-rw-r--r-- 1 root root 1 Mar 4 14:54 qq-cw-transaction-article-sync-is-lock-exist-2-1583304897.txt
-rw-r--r-- 1 root root 1 Mar 4 14:55 qq-cw-transaction-article-sync-is-lock-exist-2-1583304902.txt
-rw-r--r-- 1 root root 1 Mar 4 14:55 qq-cw-transaction-article-sync-is-lock-exist-2-1583304906.txt
-rw-r--r-- 1 root root 1 Mar 4 14:55 qq-cw-transaction-article-sync-is-lock-exist-2-1583304910.txt
-rw-r--r-- 1 root root 1 Mar 4 14:55 qq-cw-transaction-article-sync-is-lock-exist-2-1583304914.txt
-rw-r--r-- 1 root root 1 Mar 4 14:55 qq-cw-transaction-article-sync-is-lock-exist-2-1583304919.txt
-rw-r--r-- 1 root root 1 Mar 4 14:55 qq-cw-transaction-article-sync-is-lock-exist-2-1583304923.txt
-rw-r--r-- 1 root root 1 Mar 4 14:55 qq-cw-transaction-article-sync-is-lock-exist-2-1583304927.txt
-rw-r--r-- 1 root root 1 Mar 4 14:57 qq-cw-transaction-article-sync-is-lock-exist-2-1583305042.txt
-rw-r--r-- 1 root root 1 Mar 4 14:57 qq-cw-transaction-article-sync-is-lock-exist-2-1583305046.txt
-rw-r--r-- 1 root root 1 Mar 4 14:57 qq-cw-transaction-article-sync-is-lock-exist-2-1583305051.txt
-rw-r--r-- 1 root root 1 Mar 4 14:57 qq-cw-transaction-article-sync-is-lock-exist-2-1583305063.txt
-rw-r--r-- 1 root root 1 Mar 4 14:58 qq-cw-transaction-article-sync-is-lock-exist-2-1583305084.txt
-rw-r--r-- 1 root root 1 Mar 4 14:58 qq-cw-transaction-article-sync-is-lock-exist-2-1583305093.txt
-rw-r--r-- 1 root root 1 Mar 4 14:58 qq-cw-transaction-article-sync-is-lock-exist-2-1583305097.txt
[root@22f7ada2d88d logs]# ls -ltr
total 144
-rw-r--r-- 1 root root 16547 Mar 4 14:50 app.log
-rw-r--r-- 1 root root 1 Mar 4 14:50 qq-cw-transaction-article-sync-is-lock-exist-2-1583304652.txt
-rw-r--r-- 1 root root 1 Mar 4 14:51 qq-cw-transaction-article-sync-is-lock-exist-2-1583304665.txt
-rw-r--r-- 1 root root 1 Mar 4 14:51 qq-cw-transaction-article-sync-is-lock-exist-2-1583304669.txt
-rw-r--r-- 1 root root 1 Mar 4 14:51 qq-cw-transaction-article-sync-is-lock-exist-2-1583304673.txt
-rw-r--r-- 1 root root 1 Mar 4 14:51 qq-cw-transaction-article-sync-is-lock-exist-2-1583304677.txt
-rw-r--r-- 1 root root 1 Mar 4 14:51 qq-cw-transaction-article-sync-is-lock-exist-2-1583304682.txt
-rw-r--r-- 1 root root 1 Mar 4 14:51 qq-cw-transaction-article-sync-is-lock-exist-2-1583304686.txt
-rw-r--r-- 1 root root 1 Mar 4 14:51 qq-cw-transaction-article-sync-is-lock-exist-2-1583304690.txt
-rw-r--r-- 1 root root 1 Mar 4 14:51 qq-cw-transaction-article-sync-is-lock-exist-2-1583304694.txt
-rw-r--r-- 1 root root 1 Mar 4 14:51 qq-cw-transaction-article-sync-is-lock-exist-2-1583304699.txt
-rw-r--r-- 1 root root 1 Mar 4 14:51 qq-cw-transaction-article-sync-is-lock-exist-2-1583304703.txt
-rw-r--r-- 1 root root 1 Mar 4 14:51 qq-cw-transaction-article-sync-is-lock-exist-2-1583304707.txt
-rw-r--r-- 1 root root 1 Mar 4 14:51 qq-cw-transaction-article-sync-is-lock-exist-2-1583304711.txt
-rw-r--r-- 1 root root 1 Mar 4 14:52 qq-cw-transaction-article-sync-is-lock-exist-2-1583304720.txt
-rw-r--r-- 1 root root 1 Mar 4 14:53 qq-cw-transaction-article-sync-is-lock-exist-2-1583304816.txt
-rw-r--r-- 1 root root 1 Mar 4 14:54 qq-cw-transaction-article-sync-is-lock-exist-2-1583304846.txt
-rw-r--r-- 1 root root 1 Mar 4 14:54 qq-cw-transaction-article-sync-is-lock-exist-2-1583304851.txt
-rw-r--r-- 1 root root 1 Mar 4 14:54 qq-cw-transaction-article-sync-is-lock-exist-2-1583304855.txt
-rw-r--r-- 1 root root 1 Mar 4 14:54 qq-cw-transaction-article-sync-is-lock-exist-2-1583304859.txt
-rw-r--r-- 1 root root 1 Mar 4 14:54 qq-cw-transaction-article-sync-is-lock-exist-2-1583304864.txt
-rw-r--r-- 1 root root 1 Mar 4 14:54 qq-cw-transaction-article-sync-is-lock-exist-2-1583304868.txt
-rw-r--r-- 1 root root 1 Mar 4 14:55 qq-cw-transaction-article-sync-is-lock-exist-2-1583304949.txt
-rw-r--r-- 1 root root 1 Mar 4 14:55 qq-cw-transaction-article-sync-is-lock-exist-2-1583304954.txt
-rw-r--r-- 1 root root 1 Mar 4 14:55 qq-cw-transaction-article-sync-is-lock-exist-2-1583304958.txt
-rw-r--r-- 1 root root 1 Mar 4 14:56 qq-cw-transaction-article-sync-is-lock-exist-2-1583304962.txt
-rw-r--r-- 1 root root 1 Mar 4 14:56 qq-cw-transaction-article-sync-is-lock-exist-2-1583304988.txt
-rw-r--r-- 1 root root 1 Mar 4 14:56 qq-cw-transaction-article-sync-is-lock-exist-2-1583304996.txt
-rw-r--r-- 1 root root 1 Mar 4 14:57 qq-cw-transaction-article-sync-is-lock-exist-2-1583305055.txt
-rw-r--r-- 1 root root 1 Mar 4 14:57 qq-cw-transaction-article-sync-is-lock-exist-2-1583305060.txt
-rw-r--r-- 1 root root 1 Mar 4 14:57 qq-cw-transaction-article-sync-is-lock-exist-2-1583305072.txt
-rw-r--r-- 1 root root 1 Mar 4 14:58 qq-cw-transaction-article-sync-is-lock-exist-2-1583305081.txt
[root@54d07ee806e6 logs]# ls -ltr
total 60
-rw-r--r-- 1 root root 16556 Mar 4 14:53 app.log
-rw-r--r-- 1 root root 1 Mar 4 14:53 qq-cw-transaction-article-sync-is-lock-exist-2-1583304824.txt
-rw-r--r-- 1 root root 1 Mar 4 14:53 qq-cw-transaction-article-sync-is-lock-exist-2-1583304829.txt
-rw-r--r-- 1 root root 1 Mar 4 14:53 qq-cw-transaction-article-sync-is-lock-exist-2-1583304833.txt
-rw-r--r-- 1 root root 1 Mar 4 14:53 qq-cw-transaction-article-sync-is-lock-exist-2-1583304837.txt
-rw-r--r-- 1 root root 1 Mar 4 14:55 qq-cw-transaction-article-sync-is-lock-exist-2-1583304932.txt
-rw-r--r-- 1 root root 1 Mar 4 14:55 qq-cw-transaction-article-sync-is-lock-exist-2-1583304936.txt
-rw-r--r-- 1 root root 1 Mar 4 14:55 qq-cw-transaction-article-sync-is-lock-exist-2-1583304941.txt
-rw-r--r-- 1 root root 1 Mar 4 14:57 qq-cw-transaction-article-sync-is-lock-exist-2-1583305029.txt
-rw-r--r-- 1 root root 1 Mar 4 14:57 qq-cw-transaction-article-sync-is-lock-exist-2-1583305033.txt
-rw-r--r-- 1 root root 1 Mar 4 14:57 qq-cw-transaction-article-sync-is-lock-exist-2-1583305038.txt
7. The root cause of the high lock frequency should be that only the same task is executed in the command line. Determined to simulate 6 tasks, the lock frequency should be reduced. Time: 15:52 – 15:47 = 6 minutes. Number of locks: 47 + 34 + 45 = 126 . Lock frequency: 126 / 6 = 9, that is, 20 times per minute. Not as expected.
[root@7edbf272f55f logs]# ls -ltr
total 188
-rw-r--r-- 1 root root 1 Mar 4 15:47 qq-cw-transaction-video-sync-is-lock-exist-4-1583308059.txt
-rw-r--r-- 1 root root 1 Mar 4 15:47 qq-cw-transaction-video-sync-lock-5-1583308059.txt
-rw-r--r-- 1 root root 1 Mar 4 15:47 qq-cw-transaction-article-sync-is-lock-exist-6-1583308069.txt
-rw-r--r-- 1 root root 1 Mar 4 15:47 qq-cw-transaction-article-sync-is-lock-exist-8-1583308069.txt
-rw-r--r-- 1 root root 1 Mar 4 15:48 qq-cw-transaction-video-sync-is-lock-exist-9-1583308096.txt
-rw-r--r-- 1 root root 1 Mar 4 15:49 qq-cw-transaction-article-sync-is-lock-exist-7-1583308161.txt
-rw-r--r-- 1 root root 2 Mar 4 15:49 qq-cw-transaction-article-sync-is-lock-exist-11-1583308161.txt
-rw-r--r-- 1 root root 1 Mar 4 15:49 qq-cw-transaction-article-sync-is-lock-exist-6-1583308166.txt
-rw-r--r-- 1 root root 1 Mar 4 15:49 qq-cw-transaction-article-sync-is-lock-exist-8-1583308166.txt
-rw-r--r-- 1 root root 2 Mar 4 15:49 qq-cw-transaction-article-sync-is-lock-exist-12-1583308167.txt
-rw-r--r-- 1 root root 2 Mar 4 15:49 qq-cw-transaction-article-sync-is-lock-exist-11-1583308187.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-6-1583308222.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-8-1583308222.txt
-rw-r--r-- 1 root root 2 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-12-1583308222.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-6-1583308226.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-7-1583308226.txt
-rw-r--r-- 1 root root 2 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-11-1583308226.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-6-1583308230.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-7-1583308230.txt
-rw-r--r-- 1 root root 2 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-11-1583308230.txt
-rw-r--r-- 1 root root 2 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-12-1583308230.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-6-1583308234.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-7-1583308234.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-6-1583308239.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-7-1583308239.txt
-rw-r--r-- 1 root root 2 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-11-1583308239.txt
-rw-r--r-- 1 root root 2 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-12-1583308239.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-6-1583308243.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-8-1583308243.txt
-rw-r--r-- 1 root root 2 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-11-1583308243.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-6-1583308247.txt
-rw-r--r-- 1 root root 2 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-11-1583308248.txt
-rw-r--r-- 1 root root 2 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-11-1583308251.txt
-rw-r--r-- 1 root root 2 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-11-1583308256.txt
-rw-r--r-- 1 root root 2 Mar 4 15:51 qq-cw-transaction-article-sync-is-lock-exist-11-1583308260.txt
-rw-r--r-- 1 root root 2 Mar 4 15:51 qq-cw-transaction-article-sync-is-lock-exist-11-1583308264.txt
-rw-r--r-- 1 root root 2 Mar 4 15:51 qq-cw-transaction-article-sync-is-lock-exist-11-1583308268.txt
-rw-r--r-- 1 root root 2 Mar 4 15:51 qq-cw-transaction-article-sync-is-lock-exist-11-1583308272.txt
-rw-r--r-- 1 root root 2 Mar 4 15:51 qq-cw-transaction-article-sync-is-lock-exist-12-1583308277.txt
-rw-r--r-- 1 root root 2 Mar 4 15:51 qq-cw-transaction-article-sync-is-lock-exist-12-1583308281.txt
-rw-r--r-- 1 root root 2 Mar 4 15:51 qq-cw-transaction-article-sync-is-lock-exist-12-1583308290.txt
-rw-r--r-- 1 root root 2 Mar 4 15:51 qq-cw-transaction-article-sync-is-lock-exist-12-1583308294.txt
-rw-r--r-- 1 root root 2 Mar 4 15:51 qq-cw-transaction-article-sync-is-lock-exist-12-1583308303.txt
-rw-r--r-- 1 root root 2 Mar 4 15:51 qq-cw-transaction-article-sync-is-lock-exist-12-1583308307.txt
-rw-r--r-- 1 root root 2 Mar 4 15:51 qq-cw-transaction-article-sync-is-lock-exist-12-1583308311.txt
-rw-r--r-- 1 root root 2 Mar 4 15:52 qq-cw-transaction-article-sync-is-lock-exist-12-1583308332.txt
-rw-r--r-- 1 root root 2 Mar 4 15:52 qq-cw-transaction-article-sync-is-lock-exist-12-1583308344.txt
[root@22f7ada2d88d logs]# ls -ltr
total 136
-rw-r--r-- 1 root root 1 Mar 4 15:47 qq-cw-transaction-video-sync-is-lock-exist-5-1583308059.txt
-rw-r--r-- 1 root root 2 Mar 4 15:48 qq-cw-transaction-video-sync-is-lock-exist-10-1583308096.txt
-rw-r--r-- 1 root root 1 Mar 4 15:48 qq-cw-transaction-article-sync-is-lock-exist-8-1583308126.txt
-rw-r--r-- 1 root root 2 Mar 4 15:48 qq-cw-transaction-article-sync-is-lock-exist-11-1583308126.txt
-rw-r--r-- 1 root root 1 Mar 4 15:49 qq-cw-transaction-article-sync-is-lock-exist-6-1583308177.txt
-rw-r--r-- 1 root root 1 Mar 4 15:49 qq-cw-transaction-article-sync-is-lock-exist-6-1583308182.txt
-rw-r--r-- 1 root root 1 Mar 4 15:49 qq-cw-transaction-article-sync-is-lock-exist-8-1583308183.txt
-rw-r--r-- 1 root root 2 Mar 4 15:49 qq-cw-transaction-article-sync-is-lock-exist-12-1583308183.txt
-rw-r--r-- 1 root root 1 Mar 4 15:49 qq-cw-transaction-article-sync-is-lock-exist-6-1583308187.txt
-rw-r--r-- 1 root root 1 Mar 4 15:49 qq-cw-transaction-article-sync-is-lock-exist-6-1583308196.txt
-rw-r--r-- 1 root root 1 Mar 4 15:49 qq-cw-transaction-article-sync-is-lock-exist-8-1583308196.txt
-rw-r--r-- 1 root root 2 Mar 4 15:49 qq-cw-transaction-article-sync-is-lock-exist-12-1583308196.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-7-1583308206.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-7-1583308222.txt
-rw-r--r-- 1 root root 2 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-11-1583308222.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-6-1583308226.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-8-1583308226.txt
-rw-r--r-- 1 root root 2 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-12-1583308226.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-6-1583308230.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-8-1583308230.txt
-rw-r--r-- 1 root root 2 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-11-1583308230.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-7-1583308235.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-8-1583308235.txt
-rw-r--r-- 1 root root 2 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-12-1583308235.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-7-1583308239.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-8-1583308239.txt
-rw-r--r-- 1 root root 2 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-12-1583308239.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-7-1583308243.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-8-1583308243.txt
-rw-r--r-- 1 root root 2 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-12-1583308244.txt
-rw-r--r-- 1 root root 2 Mar 4 15:51 qq-cw-transaction-article-sync-is-lock-exist-12-1583308286.txt
-rw-r--r-- 1 root root 2 Mar 4 15:51 qq-cw-transaction-article-sync-is-lock-exist-12-1583308298.txt
-rw-r--r-- 1 root root 2 Mar 4 15:51 qq-cw-transaction-article-sync-is-lock-exist-12-1583308315.txt
-rw-r--r-- 1 root root 2 Mar 4 15:52 qq-cw-transaction-article-sync-is-lock-exist-12-1583308323.txt
[root@54d07ee806e6 logs]# ls -ltr
total 196
-rw-r--r-- 1 root root 1 Mar 4 15:47 qq-cw-transaction-video-sync-is-lock-exist-4-1583308059.txt
-rw-r--r-- 1 root root 1 Mar 4 15:47 qq-cw-transaction-article-sync-is-lock-exist-7-1583308069.txt
-rw-r--r-- 1 root root 1 Mar 4 15:48 qq-cw-transaction-article-sync-is-lock-exist-8-1583308087.txt
-rw-r--r-- 1 root root 17361 Mar 4 15:48 app.log
-rw-r--r-- 1 root root 2 Mar 4 15:48 qq-cw-transaction-video-sync-is-lock-exist-10-1583308096.txt
-rw-r--r-- 1 root root 1 Mar 4 15:49 qq-cw-transaction-article-sync-is-lock-exist-6-1583308160.txt
-rw-r--r-- 1 root root 1 Mar 4 15:49 qq-cw-transaction-article-sync-is-lock-exist-8-1583308161.txt
-rw-r--r-- 1 root root 2 Mar 4 15:49 qq-cw-transaction-article-sync-is-lock-exist-12-1583308161.txt
-rw-r--r-- 1 root root 1 Mar 4 15:49 qq-cw-transaction-article-sync-is-lock-exist-7-1583308166.txt
-rw-r--r-- 1 root root 2 Mar 4 15:49 qq-cw-transaction-article-sync-is-lock-exist-11-1583308167.txt
-rw-r--r-- 1 root root 1 Mar 4 15:49 qq-cw-transaction-article-sync-is-lock-exist-7-1583308177.txt
-rw-r--r-- 1 root root 1 Mar 4 15:49 qq-cw-transaction-article-sync-is-lock-exist-7-1583308182.txt
-rw-r--r-- 1 root root 2 Mar 4 15:49 qq-cw-transaction-article-sync-is-lock-exist-11-1583308183.txt
-rw-r--r-- 1 root root 1 Mar 4 15:49 qq-cw-transaction-article-sync-is-lock-exist-7-1583308187.txt
-rw-r--r-- 1 root root 1 Mar 4 15:49 qq-cw-transaction-article-sync-is-lock-exist-8-1583308187.txt
-rw-r--r-- 1 root root 2 Mar 4 15:49 qq-cw-transaction-article-sync-is-lock-exist-12-1583308187.txt
-rw-r--r-- 1 root root 1 Mar 4 15:49 qq-cw-transaction-article-sync-is-lock-exist-7-1583308196.txt
-rw-r--r-- 1 root root 2 Mar 4 15:49 qq-cw-transaction-article-sync-is-lock-exist-11-1583308196.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-6-1583308205.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-8-1583308206.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-7-1583308226.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-lock-8-1583308226.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-7-1583308230.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-8-1583308230.txt
-rw-r--r-- 1 root root 2 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-12-1583308230.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-6-1583308234.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-8-1583308235.txt
-rw-r--r-- 1 root root 2 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-11-1583308235.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-6-1583308239.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-8-1583308239.txt
-rw-r--r-- 1 root root 2 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-11-1583308239.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-6-1583308243.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-lock-7-1583308243.txt
-rw-r--r-- 1 root root 2 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-11-1583308243.txt
-rw-r--r-- 1 root root 2 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-12-1583308243.txt
-rw-r--r-- 1 root root 1 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-8-1583308248.txt
-rw-r--r-- 1 root root 2 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-12-1583308251.txt
-rw-r--r-- 1 root root 2 Mar 4 15:50 qq-cw-transaction-article-sync-is-lock-exist-12-1583308256.txt
-rw-r--r-- 1 root root 2 Mar 4 15:51 qq-cw-transaction-article-sync-is-lock-exist-12-1583308260.txt
-rw-r--r-- 1 root root 2 Mar 4 15:51 qq-cw-transaction-article-sync-is-lock-exist-12-1583308264.txt
-rw-r--r-- 1 root root 2 Mar 4 15:51 qq-cw-transaction-article-sync-is-lock-exist-12-1583308269.txt
-rw-r--r-- 1 root root 2 Mar 4 15:51 qq-cw-transaction-article-sync-is-lock-exist-12-1583308273.txt
-rw-r--r-- 1 root root 2 Mar 4 15:51 qq-cw-transaction-article-sync-is-lock-exist-11-1583308277.txt
-rw-r--r-- 1 root root 2 Mar 4 15:51 qq-cw-transaction-article-sync-is-lock-exist-11-1583308281.txt
-rw-r--r-- 1 root root 2 Mar 4 15:51 qq-cw-transaction-article-sync-is-lock-exist-11-1583308285.txt
8. Decide to adjust Bash Sleep 3 to Bash Sleep 60, that is, after the command line runs once, run it again after 60 seconds, instead of 3 seconds. Repeat step 7, the Redis lock log does not exist. in line with expectations.
9. Arranged based on synchronization time and ID order (the transaction of the penguin number). When a task starts to execute, the synchronization time of the transaction of the update Penguin is the current time, so as to improve the execution performance and reduce the lock frequency again.
// 查询企鹅号的应用类型,cw:内容网站应用 && 类型,1:文章 && 状态,3:处理中 && 文章发布状态:审核中的5条记录,基于同步时间、ID顺序排列(企鹅号的事务)
$qqTransactionArticleItems = QqTransaction::find()->where(['qq_app_type' => QqArticle::QQ_APP_TYPE_CW, 'type' => QqTransaction::TYPE_ARTICLE, 'article_pub_flag' => HttpQqApiTransaction::ARTICLE_PUB_FLAG_REVIEW])->isDeletedNo()->processing()->orderBy(['synced_at' => SORT_ASC, 'id' => SORT_ASC])->limit(5)->all();
if ($qqTransactionArticleItems) {
foreach ($qqTransactionArticleItems as $qqTransactionArticleItem) {
/* 判断Redis模型的锁定是否存在 */
$redisLockKeyName = 'qq_cw_transaction_article:sync:' . implode(':', ['id' => $qqTransactionArticleItem->id]);
$redisLock = new RedisLock();
$isLockExist = $redisLock->isLockExist($redisLockKeyName);
// 返回 true,表示锁定存在,即已经被其他客户端锁定
if ($isLockExist === true) {
continue;
}
/* Redis模型的锁定实现 */
$lock = $redisLock->lock($redisLockKeyName, 600);
// 返回 false,表示已经被其他客户端锁定
if ($lock === false) {
continue;
}
// 基于ID查找单个数据模型(企鹅号的事务)
$qqTransactionArticleItem = QqTransaction::findOne($qqTransactionArticleItem->id);
// 更新企鹅号的事务的同步时间
$qqTransactionArticleItem->synced_at = time();
$qqTransactionArticleItem->update();
file_put_contents('/mcloud/www/channel-pub-api/console/runtime/logs/qq-cw-transaction-article-sync-' . $qqTransactionArticleItem->id . '-' . time() . '.txt', $qqTransactionArticleItem->id);
}
}
10. Simulate 3 tasks. The synchronization time (minutes) of transaction IDs 41, 42, and 43 are: 9, 9, and 8, respectively. The number of synchronization times with transaction IDs 41, 42, and 43 is: 22, 20, and 17, respectively. The synchronization frequencies of the transaction IDs 41, 42, and 43 are: 9 * 60 / 22 = 25, 9 * 60 / 20 = 27, 8 * 60 / 17 = 28. Get the average: (25 + 27 + 28) / 3 = 27. The theoretical calculation formula, the further method is rounded (the number of transactions / 5) / the number of containers * 60. in line with expectations. as shown in Figure 7
[root@21325d776096 logs]# ls -ltr
total 64
-rw-r--r-- 1 root root 2 Mar 5 17:04 qq-cw-transaction-article-sync-41-1583399050.txt
-rw-r--r-- 1 root root 2 Mar 5 17:04 qq-cw-transaction-article-sync-43-1583399050.txt
-rw-r--r-- 1 root root 2 Mar 5 17:05 qq-cw-transaction-article-sync-41-1583399112.txt
-rw-r--r-- 1 root root 2 Mar 5 17:05 qq-cw-transaction-article-sync-42-1583399112.txt
-rw-r--r-- 1 root root 2 Mar 5 17:06 qq-cw-transaction-article-sync-41-1583399173.txt
-rw-r--r-- 1 root root 2 Mar 5 17:06 qq-cw-transaction-article-sync-42-1583399174.txt
-rw-r--r-- 1 root root 2 Mar 5 17:07 qq-cw-transaction-article-sync-41-1583399235.txt
-rw-r--r-- 1 root root 2 Mar 5 17:07 qq-cw-transaction-article-sync-42-1583399235.txt
-rw-r--r-- 1 root root 2 Mar 5 17:07 qq-cw-transaction-article-sync-43-1583399236.txt
-rw-r--r-- 1 root root 2 Mar 5 17:08 qq-cw-transaction-article-sync-41-1583399297.txt
-rw-r--r-- 1 root root 2 Mar 5 17:08 qq-cw-transaction-article-sync-43-1583399298.txt
-rw-r--r-- 1 root root 2 Mar 5 17:09 qq-cw-transaction-article-sync-41-1583399359.txt
-rw-r--r-- 1 root root 2 Mar 5 17:09 qq-cw-transaction-article-sync-42-1583399359.txt
-rw-r--r-- 1 root root 2 Mar 5 17:10 qq-cw-transaction-article-sync-41-1583399421.txt
-rw-r--r-- 1 root root 2 Mar 5 17:10 qq-cw-transaction-article-sync-42-1583399421.txt
-rw-r--r-- 1 root root 2 Mar 5 17:11 qq-cw-transaction-article-sync-42-1583399483.txt
[root@e9565f71310d logs]# ls -ltr
total 100
-rw-r--r-- 1 root root 2 Mar 5 17:03 qq-cw-transaction-article-sync-41-1583399012.txt
-rw-r--r-- 1 root root 2 Mar 5 17:03 qq-cw-transaction-article-sync-42-1583399013.txt
-rw-r--r-- 1 root root 2 Mar 5 17:03 qq-cw-transaction-article-sync-43-1583399013.txt
-rw-r--r-- 1 root root 2 Mar 5 17:04 qq-cw-transaction-article-sync-41-1583399074.txt
-rw-r--r-- 1 root root 2 Mar 5 17:04 qq-cw-transaction-article-sync-42-1583399075.txt
-rw-r--r-- 1 root root 2 Mar 5 17:04 qq-cw-transaction-article-sync-43-1583399076.txt
-rw-r--r-- 1 root root 2 Mar 5 17:05 qq-cw-transaction-article-sync-41-1583399137.txt
-rw-r--r-- 1 root root 2 Mar 5 17:05 qq-cw-transaction-article-sync-42-1583399138.txt
-rw-r--r-- 1 root root 2 Mar 5 17:05 qq-cw-transaction-article-sync-43-1583399139.txt
-rw-r--r-- 1 root root 2 Mar 5 17:06 qq-cw-transaction-article-sync-41-1583399200.txt
-rw-r--r-- 1 root root 2 Mar 5 17:06 qq-cw-transaction-article-sync-42-1583399201.txt
-rw-r--r-- 1 root root 2 Mar 5 17:06 qq-cw-transaction-article-sync-43-1583399201.txt
-rw-r--r-- 1 root root 2 Mar 5 17:07 qq-cw-transaction-article-sync-41-1583399263.txt
-rw-r--r-- 1 root root 2 Mar 5 17:07 qq-cw-transaction-article-sync-42-1583399264.txt
-rw-r--r-- 1 root root 2 Mar 5 17:07 qq-cw-transaction-article-sync-43-1583399264.txt
-rw-r--r-- 1 root root 2 Mar 5 17:08 qq-cw-transaction-article-sync-41-1583399325.txt
-rw-r--r-- 1 root root 2 Mar 5 17:08 qq-cw-transaction-article-sync-42-1583399326.txt
-rw-r--r-- 1 root root 2 Mar 5 17:08 qq-cw-transaction-article-sync-43-1583399326.txt
-rw-r--r-- 1 root root 2 Mar 5 17:09 qq-cw-transaction-article-sync-42-1583399388.txt
-rw-r--r-- 1 root root 2 Mar 5 17:09 qq-cw-transaction-article-sync-43-1583399388.txt
-rw-r--r-- 1 root root 2 Mar 5 17:09 qq-cw-transaction-article-sync-41-1583399388.txt
-rw-r--r-- 1 root root 2 Mar 5 17:10 qq-cw-transaction-article-sync-42-1583399450.txt
-rw-r--r-- 1 root root 2 Mar 5 17:10 qq-cw-transaction-article-sync-43-1583399451.txt
-rw-r--r-- 1 root root 2 Mar 5 17:10 qq-cw-transaction-article-sync-41-1583399451.txt
-rw-r--r-- 1 root root 2 Mar 5 17:11 qq-cw-transaction-article-sync-42-1583399512.txt
[root@7c7a4390ba3f logs]# ls -ltr
total 72
-rw-r--r-- 1 root root 2 Mar 5 17:04 qq-cw-transaction-article-sync-42-1583399050.txt
-rw-r--r-- 1 root root 2 Mar 5 17:04 qq-cw-transaction-article-sync-43-1583399050.txt
-rw-r--r-- 1 root root 2 Mar 5 17:04 qq-cw-transaction-article-sync-41-1583399050.txt
-rw-r--r-- 1 root root 2 Mar 5 17:05 qq-cw-transaction-article-sync-43-1583399112.txt
-rw-r--r-- 1 root root 2 Mar 5 17:05 qq-cw-transaction-article-sync-41-1583399112.txt
-rw-r--r-- 1 root root 2 Mar 5 17:06 qq-cw-transaction-article-sync-43-1583399174.txt
-rw-r--r-- 1 root root 2 Mar 5 17:06 qq-cw-transaction-article-sync-41-1583399174.txt
-rw-r--r-- 1 root root 2 Mar 5 17:06 qq-cw-transaction-article-sync-42-1583399174.txt
-rw-r--r-- 1 root root 2 Mar 5 17:07 qq-cw-transaction-article-sync-41-1583399236.txt
-rw-r--r-- 1 root root 2 Mar 5 17:07 qq-cw-transaction-article-sync-42-1583399236.txt
-rw-r--r-- 1 root root 2 Mar 5 17:08 qq-cw-transaction-article-sync-42-1583399298.txt
-rw-r--r-- 1 root root 2 Mar 5 17:08 qq-cw-transaction-article-sync-43-1583399298.txt
-rw-r--r-- 1 root root 2 Mar 5 17:08 qq-cw-transaction-article-sync-41-1583399298.txt
-rw-r--r-- 1 root root 2 Mar 5 17:09 qq-cw-transaction-article-sync-43-1583399360.txt
-rw-r--r-- 1 root root 2 Mar 5 17:09 qq-cw-transaction-article-sync-41-1583399360.txt
-rw-r--r-- 1 root root 2 Mar 5 17:10 qq-cw-transaction-article-sync-43-1583399421.txt
-rw-r--r-- 1 root root 2 Mar 5 17:10 qq-cw-transaction-article-sync-41-1583399422.txt
-rw-r--r-- 1 root root 2 Mar 5 17:11 qq-cw-transaction-article-sync-42-1583399483.txt
11. Simulate 5 tasks. The synchronization time (minutes) of the transaction IDs of 47, 48, 49, 52, and 53 are: 4, 11, 4, 5, 5, respectively. The number of synchronizations with transaction IDs 47, 48, 49, 52, and 53 is: 10, 20, 10, 9, 10, respectively. The synchronization frequency of transaction IDs 47, 48, 49, 52, and 53 are: 4 * 60 / 10 = 24, 11 * 60 / 20 = 33, 4 * 60 / 10 = 24, 5 * 60 / 9 = 33, 5 * 60 / 10 = 30. Get averages: (24 + 33 + 24 + 33 + 30) / 5 = 29. The theoretical calculation formula, the further method is rounded (the number of transactions / 5) / the number of containers * 60. in line with expectations. as shown in Figure 8
[root@21325d776096 logs]# ls -ltr
total 88
-rw-r--r-- 1 root root 2 Mar 6 09:55 qq-cw-transaction-article-sync-47-1583459743.txt
-rw-r--r-- 1 root root 2 Mar 6 09:55 qq-cw-transaction-article-sync-48-1583459744.txt
-rw-r--r-- 1 root root 2 Mar 6 09:55 qq-cw-transaction-article-sync-49-1583459744.txt
-rw-r--r-- 1 root root 2 Mar 6 09:56 qq-cw-transaction-article-sync-52-1583459806.txt
-rw-r--r-- 1 root root 2 Mar 6 09:56 qq-cw-transaction-article-sync-47-1583459807.txt
-rw-r--r-- 1 root root 2 Mar 6 09:56 qq-cw-transaction-article-sync-48-1583459807.txt
-rw-r--r-- 1 root root 2 Mar 6 09:56 qq-cw-transaction-article-sync-49-1583459807.txt
-rw-r--r-- 1 root root 2 Mar 6 09:56 qq-cw-transaction-article-sync-53-1583459807.txt
-rw-r--r-- 1 root root 2 Mar 6 09:57 qq-cw-transaction-article-sync-47-1583459869.txt
-rw-r--r-- 1 root root 2 Mar 6 09:57 qq-cw-transaction-article-sync-48-1583459869.txt
-rw-r--r-- 1 root root 2 Mar 6 09:57 qq-cw-transaction-article-sync-52-1583459870.txt
-rw-r--r-- 1 root root 2 Mar 6 09:57 qq-cw-transaction-article-sync-49-1583459870.txt
-rw-r--r-- 1 root root 2 Mar 6 09:57 qq-cw-transaction-article-sync-53-1583459870.txt
-rw-r--r-- 1 root root 2 Mar 6 09:58 qq-cw-transaction-article-sync-48-1583459932.txt
-rw-r--r-- 1 root root 2 Mar 6 09:58 qq-cw-transaction-article-sync-52-1583459932.txt
-rw-r--r-- 1 root root 2 Mar 6 09:58 qq-cw-transaction-article-sync-53-1583459932.txt
-rw-r--r-- 1 root root 2 Mar 6 09:59 qq-cw-transaction-article-sync-48-1583459994.txt
-rw-r--r-- 1 root root 2 Mar 6 10:00 qq-cw-transaction-article-sync-48-1583460055.txt
-rw-r--r-- 1 root root 2 Mar 6 10:01 qq-cw-transaction-article-sync-48-1583460117.txt
-rw-r--r-- 1 root root 2 Mar 6 10:02 qq-cw-transaction-article-sync-48-1583460179.txt
-rw-r--r-- 1 root root 2 Mar 6 10:04 qq-cw-transaction-article-sync-48-1583460240.txt
-rw-r--r-- 1 root root 2 Mar 6 10:05 qq-cw-transaction-article-sync-48-1583460302.txt
[root@e9565f71310d logs]# ls -ltr
total 96
-rw-r--r-- 1 root root 2 Mar 6 09:55 qq-cw-transaction-article-sync-52-1583459751.txt
-rw-r--r-- 1 root root 2 Mar 6 09:55 qq-cw-transaction-article-sync-53-1583459752.txt
-rw-r--r-- 1 root root 2 Mar 6 09:55 qq-cw-transaction-article-sync-47-1583459752.txt
-rw-r--r-- 1 root root 2 Mar 6 09:55 qq-cw-transaction-article-sync-48-1583459752.txt
-rw-r--r-- 1 root root 2 Mar 6 09:55 qq-cw-transaction-article-sync-49-1583459752.txt
-rw-r--r-- 1 root root 2 Mar 6 09:56 qq-cw-transaction-article-sync-52-1583459813.txt
-rw-r--r-- 1 root root 2 Mar 6 09:56 qq-cw-transaction-article-sync-47-1583459813.txt
-rw-r--r-- 1 root root 2 Mar 6 09:56 qq-cw-transaction-article-sync-48-1583459814.txt
-rw-r--r-- 1 root root 2 Mar 6 09:56 qq-cw-transaction-article-sync-49-1583459814.txt
-rw-r--r-- 1 root root 2 Mar 6 09:56 qq-cw-transaction-article-sync-53-1583459814.txt
-rw-r--r-- 1 root root 2 Mar 6 09:57 qq-cw-transaction-article-sync-47-1583459876.txt
-rw-r--r-- 1 root root 2 Mar 6 09:57 qq-cw-transaction-article-sync-48-1583459877.txt
-rw-r--r-- 1 root root 2 Mar 6 09:57 qq-cw-transaction-article-sync-49-1583459877.txt
-rw-r--r-- 1 root root 2 Mar 6 09:57 qq-cw-transaction-article-sync-52-1583459878.txt
-rw-r--r-- 1 root root 2 Mar 6 09:57 qq-cw-transaction-article-sync-53-1583459878.txt
-rw-r--r-- 1 root root 2 Mar 6 09:59 qq-cw-transaction-article-sync-48-1583459940.txt
-rw-r--r-- 1 root root 2 Mar 6 09:59 qq-cw-transaction-article-sync-52-1583459940.txt
-rw-r--r-- 1 root root 2 Mar 6 09:59 qq-cw-transaction-article-sync-53-1583459941.txt
-rw-r--r-- 1 root root 2 Mar 6 10:00 qq-cw-transaction-article-sync-48-1583460002.txt
-rw-r--r-- 1 root root 2 Mar 6 10:01 qq-cw-transaction-article-sync-48-1583460063.txt
-rw-r--r-- 1 root root 2 Mar 6 10:02 qq-cw-transaction-article-sync-48-1583460125.txt
-rw-r--r-- 1 root root 2 Mar 6 10:03 qq-cw-transaction-article-sync-48-1583460187.txt
-rw-r--r-- 1 root root 2 Mar 6 10:04 qq-cw-transaction-article-sync-48-1583460248.txt
-rw-r--r-- 1 root root 2 Mar 6 10:05 qq-cw-transaction-article-sync-48-1583460310.txt
[root@7c7a4390ba3f logs]# ls -ltr
total 120
-rw-r--r-- 1 root root 17367 Mar 6 09:55 app.log
-rw-r--r-- 1 root root 2 Mar 6 09:55 qq-cw-transaction-article-sync-47-1583459731.txt
-rw-r--r-- 1 root root 2 Mar 6 09:55 qq-cw-transaction-article-sync-48-1583459732.txt
-rw-r--r-- 1 root root 2 Mar 6 09:55 qq-cw-transaction-article-sync-49-1583459732.txt
-rw-r--r-- 1 root root 2 Mar 6 09:56 qq-cw-transaction-article-sync-52-1583459793.txt
-rw-r--r-- 1 root root 2 Mar 6 09:56 qq-cw-transaction-article-sync-47-1583459794.txt
-rw-r--r-- 1 root root 2 Mar 6 09:56 qq-cw-transaction-article-sync-48-1583459794.txt
-rw-r--r-- 1 root root 2 Mar 6 09:56 qq-cw-transaction-article-sync-49-1583459794.txt
-rw-r--r-- 1 root root 2 Mar 6 09:56 qq-cw-transaction-article-sync-53-1583459795.txt
-rw-r--r-- 1 root root 2 Mar 6 09:57 qq-cw-transaction-article-sync-47-1583459856.txt
-rw-r--r-- 1 root root 2 Mar 6 09:57 qq-cw-transaction-article-sync-52-1583459857.txt
-rw-r--r-- 1 root root 2 Mar 6 09:57 qq-cw-transaction-article-sync-48-1583459857.txt
-rw-r--r-- 1 root root 2 Mar 6 09:57 qq-cw-transaction-article-sync-49-1583459858.txt
-rw-r--r-- 1 root root 2 Mar 6 09:57 qq-cw-transaction-article-sync-53-1583459859.txt
-rw-r--r-- 1 root root 2 Mar 6 09:58 qq-cw-transaction-article-sync-47-1583459920.txt
-rw-r--r-- 1 root root 2 Mar 6 09:58 qq-cw-transaction-article-sync-48-1583459921.txt
-rw-r--r-- 1 root root 2 Mar 6 09:58 qq-cw-transaction-article-sync-49-1583459922.txt
-rw-r--r-- 1 root root 2 Mar 6 09:58 qq-cw-transaction-article-sync-52-1583459922.txt
-rw-r--r-- 1 root root 2 Mar 6 09:58 qq-cw-transaction-article-sync-53-1583459922.txt
-rw-r--r-- 1 root root 2 Mar 6 09:59 qq-cw-transaction-article-sync-48-1583459984.txt
-rw-r--r-- 1 root root 2 Mar 6 10:00 qq-cw-transaction-article-sync-48-1583460045.txt
-rw-r--r-- 1 root root 2 Mar 6 10:01 qq-cw-transaction-article-sync-48-1583460107.txt
-rw-r--r-- 1 root root 2 Mar 6 10:02 qq-cw-transaction-article-sync-48-1583460169.txt
-rw-r--r-- 1 root root 2 Mar 6 10:03 qq-cw-transaction-article-sync-48-1583460231.txt
-rw-r--r-- 1 root root 2 Mar 6 10:04 qq-cw-transaction-article-sync-48-1583460293.txt
-rw-r--r-- 1 root root 2 Mar 6 10:05 qq-cw-transaction-article-sync-48-1583460355.txt
12. Simulate 8 tasks. The synchronization time (minutes) of transaction IDs 57, 58, 59, 63, 64, 65, 68, and 69 are: 11, 12, 13, 12, 11, 12, 11, 12, respectively. The number of synchronizations with transaction IDs 57, 58, 59, 63, 64, 65, 68, and 69 are: 21, 22, 22, 19, 17, 5, 17, 17, respectively. The sync frequency of the transaction IDs 57, 58, 59, 63, 64, 65, 68, and 69 is: 11 * 60 / 21 = 31, 12 * 60 / 22 = 33, 13 * 60 / 22 = 35, 12 * 60 / 19 = 38, 11 * 60 / 17 = 39, 12 * 60 / 5 = 144, 11 * 60 / 17 = 39, 12 * 60 / 17 = 42. Get averages: (31 + 33 + 35 + 38 + 39 + 144 + 39 + 42) / 8 = 50. The theoretical calculation formula, the further method is rounded (the number of transactions / 5) / the number of containers * 60. in line with expectations. as shown in Figure 9
[root@21325d776096 logs]# ls -ltr
total 220
-rw-r--r-- 1 root root 2 Mar 6 10:30 qq-cw-transaction-article-sync-57-1583461834.txt
-rw-r--r-- 1 root root 2 Mar 6 10:30 qq-cw-transaction-article-sync-58-1583461834.txt
-rw-r--r-- 1 root root 2 Mar 6 10:30 qq-cw-transaction-article-sync-59-1583461834.txt
-rw-r--r-- 1 root root 2 Mar 6 10:31 qq-cw-transaction-article-sync-68-1583461896.txt
-rw-r--r-- 1 root root 2 Mar 6 10:31 qq-cw-transaction-article-sync-69-1583461896.txt
-rw-r--r-- 1 root root 2 Mar 6 10:31 qq-cw-transaction-article-sync-57-1583461897.txt
-rw-r--r-- 1 root root 2 Mar 6 10:31 qq-cw-transaction-article-sync-58-1583461897.txt
-rw-r--r-- 1 root root 2 Mar 6 10:32 qq-cw-transaction-article-sync-63-1583461959.txt
-rw-r--r-- 1 root root 2 Mar 6 10:32 qq-cw-transaction-article-sync-64-1583461959.txt
-rw-r--r-- 1 root root 2 Mar 6 10:32 qq-cw-transaction-article-sync-68-1583461959.txt
-rw-r--r-- 1 root root 2 Mar 6 10:32 qq-cw-transaction-article-sync-69-1583461959.txt
-rw-r--r-- 1 root root 2 Mar 6 10:33 qq-cw-transaction-article-sync-58-1583462021.txt
-rw-r--r-- 1 root root 2 Mar 6 10:33 qq-cw-transaction-article-sync-59-1583462022.txt
-rw-r--r-- 1 root root 2 Mar 6 10:33 qq-cw-transaction-article-sync-63-1583462022.txt
-rw-r--r-- 1 root root 2 Mar 6 10:33 qq-cw-transaction-article-sync-57-1583462022.txt
-rw-r--r-- 1 root root 2 Mar 6 10:34 qq-cw-transaction-article-sync-68-1583462084.txt
-rw-r--r-- 1 root root 2 Mar 6 10:34 qq-cw-transaction-article-sync-58-1583462084.txt
-rw-r--r-- 1 root root 2 Mar 6 10:34 qq-cw-transaction-article-sync-69-1583462085.txt
-rw-r--r-- 1 root root 2 Mar 6 10:34 qq-cw-transaction-article-sync-59-1583462085.txt
-rw-r--r-- 1 root root 34566 Mar 6 10:35 app.log
-rw-r--r-- 1 root root 2 Mar 6 10:35 qq-cw-transaction-article-sync-63-1583462146.txt
-rw-r--r-- 1 root root 2 Mar 6 10:35 qq-cw-transaction-article-sync-64-1583462147.txt
-rw-r--r-- 1 root root 2 Mar 6 10:35 qq-cw-transaction-article-sync-68-1583462147.txt
-rw-r--r-- 1 root root 2 Mar 6 10:35 qq-cw-transaction-article-sync-57-1583462147.txt
-rw-r--r-- 1 root root 2 Mar 6 10:36 qq-cw-transaction-article-sync-59-1583462209.txt
-rw-r--r-- 1 root root 2 Mar 6 10:36 qq-cw-transaction-article-sync-63-1583462209.txt
-rw-r--r-- 1 root root 2 Mar 6 10:36 qq-cw-transaction-article-sync-69-1583462210.txt
-rw-r--r-- 1 root root 2 Mar 6 10:36 qq-cw-transaction-article-sync-57-1583462210.txt
-rw-r--r-- 1 root root 2 Mar 6 10:37 qq-cw-transaction-article-sync-64-1583462271.txt
-rw-r--r-- 1 root root 2 Mar 6 10:37 qq-cw-transaction-article-sync-68-1583462272.txt
-rw-r--r-- 1 root root 2 Mar 6 10:37 qq-cw-transaction-article-sync-59-1583462272.txt
-rw-r--r-- 1 root root 2 Mar 6 10:37 qq-cw-transaction-article-sync-57-1583462272.txt
-rw-r--r-- 1 root root 2 Mar 6 10:38 qq-cw-transaction-article-sync-63-1583462334.txt
-rw-r--r-- 1 root root 2 Mar 6 10:38 qq-cw-transaction-article-sync-64-1583462334.txt
-rw-r--r-- 1 root root 2 Mar 6 10:38 qq-cw-transaction-article-sync-69-1583462335.txt
-rw-r--r-- 1 root root 2 Mar 6 10:38 qq-cw-transaction-article-sync-57-1583462335.txt
-rw-r--r-- 1 root root 2 Mar 6 10:39 qq-cw-transaction-article-sync-59-1583462396.txt
-rw-r--r-- 1 root root 2 Mar 6 10:39 qq-cw-transaction-article-sync-63-1583462397.txt
-rw-r--r-- 1 root root 2 Mar 6 10:39 qq-cw-transaction-article-sync-68-1583462397.txt
-rw-r--r-- 1 root root 2 Mar 6 10:39 qq-cw-transaction-article-sync-57-1583462397.txt
-rw-r--r-- 1 root root 2 Mar 6 10:40 qq-cw-transaction-article-sync-59-1583462459.txt
-rw-r--r-- 1 root root 2 Mar 6 10:40 qq-cw-transaction-article-sync-64-1583462459.txt
-rw-r--r-- 1 root root 2 Mar 6 10:41 qq-cw-transaction-article-sync-69-1583462460.txt
-rw-r--r-- 1 root root 2 Mar 6 10:41 qq-cw-transaction-article-sync-65-1583462460.txt
-rw-r--r-- 1 root root 2 Mar 6 10:41 qq-cw-transaction-article-sync-58-1583462460.txt
-rw-r--r-- 1 root root 2 Mar 6 10:42 qq-cw-transaction-article-sync-69-1583462522.txt
-rw-r--r-- 1 root root 2 Mar 6 10:42 qq-cw-transaction-article-sync-59-1583462523.txt
[root@e9565f71310d logs]# ls -ltr
total 212
-rw-r--r-- 1 root root 2 Mar 6 10:30 qq-cw-transaction-article-sync-63-1583461842.txt
-rw-r--r-- 1 root root 2 Mar 6 10:30 qq-cw-transaction-article-sync-64-1583461842.txt
-rw-r--r-- 1 root root 2 Mar 6 10:30 qq-cw-transaction-article-sync-65-1583461843.txt
-rw-r--r-- 1 root root 2 Mar 6 10:31 qq-cw-transaction-article-sync-59-1583461905.txt
-rw-r--r-- 1 root root 2 Mar 6 10:31 qq-cw-transaction-article-sync-63-1583461905.txt
-rw-r--r-- 1 root root 2 Mar 6 10:31 qq-cw-transaction-article-sync-64-1583461906.txt
-rw-r--r-- 1 root root 2 Mar 6 10:31 qq-cw-transaction-article-sync-68-1583461906.txt
-rw-r--r-- 1 root root 2 Mar 6 10:32 qq-cw-transaction-article-sync-57-1583461968.txt
-rw-r--r-- 1 root root 2 Mar 6 10:32 qq-cw-transaction-article-sync-58-1583461968.txt
-rw-r--r-- 1 root root 2 Mar 6 10:32 qq-cw-transaction-article-sync-59-1583461969.txt
-rw-r--r-- 1 root root 2 Mar 6 10:32 qq-cw-transaction-article-sync-63-1583461969.txt
-rw-r--r-- 1 root root 2 Mar 6 10:33 qq-cw-transaction-article-sync-64-1583462030.txt
-rw-r--r-- 1 root root 2 Mar 6 10:33 qq-cw-transaction-article-sync-68-1583462031.txt
-rw-r--r-- 1 root root 2 Mar 6 10:33 qq-cw-transaction-article-sync-69-1583462032.txt
-rw-r--r-- 1 root root 2 Mar 6 10:33 qq-cw-transaction-article-sync-58-1583462032.txt
-rw-r--r-- 1 root root 33937 Mar 6 10:34 app.log
-rw-r--r-- 1 root root 2 Mar 6 10:34 qq-cw-transaction-article-sync-57-1583462093.txt
-rw-r--r-- 1 root root 2 Mar 6 10:34 qq-cw-transaction-article-sync-63-1583462094.txt
-rw-r--r-- 1 root root 2 Mar 6 10:34 qq-cw-transaction-article-sync-64-1583462094.txt
-rw-r--r-- 1 root root 2 Mar 6 10:34 qq-cw-transaction-article-sync-68-1583462094.txt
-rw-r--r-- 1 root root 2 Mar 6 10:35 qq-cw-transaction-article-sync-58-1583462155.txt
-rw-r--r-- 1 root root 2 Mar 6 10:35 qq-cw-transaction-article-sync-59-1583462156.txt
-rw-r--r-- 1 root root 2 Mar 6 10:35 qq-cw-transaction-article-sync-69-1583462156.txt
-rw-r--r-- 1 root root 2 Mar 6 10:35 qq-cw-transaction-article-sync-63-1583462156.txt
-rw-r--r-- 1 root root 2 Mar 6 10:36 qq-cw-transaction-article-sync-58-1583462218.txt
-rw-r--r-- 1 root root 2 Mar 6 10:36 qq-cw-transaction-article-sync-64-1583462218.txt
-rw-r--r-- 1 root root 2 Mar 6 10:36 qq-cw-transaction-article-sync-68-1583462218.txt
-rw-r--r-- 1 root root 2 Mar 6 10:36 qq-cw-transaction-article-sync-59-1583462219.txt
-rw-r--r-- 1 root root 2 Mar 6 10:38 qq-cw-transaction-article-sync-58-1583462280.txt
-rw-r--r-- 1 root root 2 Mar 6 10:38 qq-cw-transaction-article-sync-63-1583462281.txt
-rw-r--r-- 1 root root 2 Mar 6 10:38 qq-cw-transaction-article-sync-69-1583462281.txt
-rw-r--r-- 1 root root 2 Mar 6 10:38 qq-cw-transaction-article-sync-64-1583462281.txt
-rw-r--r-- 1 root root 2 Mar 6 10:39 qq-cw-transaction-article-sync-58-1583462343.txt
-rw-r--r-- 1 root root 2 Mar 6 10:39 qq-cw-transaction-article-sync-59-1583462344.txt
-rw-r--r-- 1 root root 2 Mar 6 10:39 qq-cw-transaction-article-sync-68-1583462344.txt
-rw-r--r-- 1 root root 2 Mar 6 10:39 qq-cw-transaction-article-sync-63-1583462344.txt
-rw-r--r-- 1 root root 2 Mar 6 10:40 qq-cw-transaction-article-sync-58-1583462406.txt
-rw-r--r-- 1 root root 2 Mar 6 10:40 qq-cw-transaction-article-sync-64-1583462406.txt
-rw-r--r-- 1 root root 2 Mar 6 10:40 qq-cw-transaction-article-sync-69-1583462406.txt
-rw-r--r-- 1 root root 2 Mar 6 10:40 qq-cw-transaction-article-sync-59-1583462406.txt
-rw-r--r-- 1 root root 2 Mar 6 10:41 qq-cw-transaction-article-sync-63-1583462468.txt
-rw-r--r-- 1 root root 2 Mar 6 10:41 qq-cw-transaction-article-sync-68-1583462468.txt
-rw-r--r-- 1 root root 2 Mar 6 10:41 qq-cw-transaction-article-sync-59-1583462469.txt
-rw-r--r-- 1 root root 2 Mar 6 10:41 qq-cw-transaction-article-sync-58-1583462469.txt
-rw-r--r-- 1 root root 2 Mar 6 10:41 qq-cw-transaction-article-sync-65-1583462470.txt
[root@7c7a4390ba3f logs]# ls -ltr
total 220
-rw-r--r-- 1 root root 2 Mar 6 10:30 qq-cw-transaction-article-sync-57-1583461824.txt
-rw-r--r-- 1 root root 2 Mar 6 10:30 qq-cw-transaction-article-sync-58-1583461825.txt
-rw-r--r-- 1 root root 2 Mar 6 10:30 qq-cw-transaction-article-sync-59-1583461825.txt
-rw-r--r-- 1 root root 2 Mar 6 10:31 qq-cw-transaction-article-sync-57-1583461886.txt
-rw-r--r-- 1 root root 2 Mar 6 10:31 qq-cw-transaction-article-sync-58-1583461886.txt
-rw-r--r-- 1 root root 2 Mar 6 10:31 qq-cw-transaction-article-sync-59-1583461886.txt
-rw-r--r-- 1 root root 2 Mar 6 10:31 qq-cw-transaction-article-sync-63-1583461887.txt
-rw-r--r-- 1 root root 2 Mar 6 10:31 qq-cw-transaction-article-sync-64-1583461887.txt
-rw-r--r-- 1 root root 2 Mar 6 10:32 qq-cw-transaction-article-sync-69-1583461948.txt
-rw-r--r-- 1 root root 2 Mar 6 10:32 qq-cw-transaction-article-sync-57-1583461949.txt
-rw-r--r-- 1 root root 2 Mar 6 10:32 qq-cw-transaction-article-sync-58-1583461949.txt
-rw-r--r-- 1 root root 2 Mar 6 10:32 qq-cw-transaction-article-sync-59-1583461949.txt
-rw-r--r-- 1 root root 2 Mar 6 10:33 qq-cw-transaction-article-sync-64-1583462011.txt
-rw-r--r-- 1 root root 2 Mar 6 10:33 qq-cw-transaction-article-sync-68-1583462011.txt
-rw-r--r-- 1 root root 2 Mar 6 10:33 qq-cw-transaction-article-sync-69-1583462011.txt
-rw-r--r-- 1 root root 2 Mar 6 10:33 qq-cw-transaction-article-sync-57-1583462011.txt
-rw-r--r-- 1 root root 2 Mar 6 10:34 qq-cw-transaction-article-sync-59-1583462073.txt
-rw-r--r-- 1 root root 2 Mar 6 10:34 qq-cw-transaction-article-sync-57-1583462074.txt
-rw-r--r-- 1 root root 2 Mar 6 10:34 qq-cw-transaction-article-sync-63-1583462074.txt
-rw-r--r-- 1 root root 2 Mar 6 10:34 qq-cw-transaction-article-sync-64-1583462074.txt
-rw-r--r-- 1 root root 17200 Mar 6 10:35 app.log
-rw-r--r-- 1 root root 2 Mar 6 10:35 qq-cw-transaction-article-sync-58-1583462136.txt
-rw-r--r-- 1 root root 2 Mar 6 10:35 qq-cw-transaction-article-sync-59-1583462136.txt
-rw-r--r-- 1 root root 2 Mar 6 10:35 qq-cw-transaction-article-sync-69-1583462136.txt
-rw-r--r-- 1 root root 2 Mar 6 10:35 qq-cw-transaction-article-sync-57-1583462136.txt
-rw-r--r-- 1 root root 2 Mar 6 10:36 qq-cw-transaction-article-sync-57-1583462198.txt
-rw-r--r-- 1 root root 2 Mar 6 10:36 qq-cw-transaction-article-sync-64-1583462199.txt
-rw-r--r-- 1 root root 2 Mar 6 10:36 qq-cw-transaction-article-sync-68-1583462199.txt
-rw-r--r-- 1 root root 2 Mar 6 10:36 qq-cw-transaction-article-sync-58-1583462199.txt
-rw-r--r-- 1 root root 2 Mar 6 10:37 qq-cw-transaction-article-sync-63-1583462261.txt
-rw-r--r-- 1 root root 2 Mar 6 10:37 qq-cw-transaction-article-sync-57-1583462261.txt
-rw-r--r-- 1 root root 2 Mar 6 10:37 qq-cw-transaction-article-sync-69-1583462261.txt
-rw-r--r-- 1 root root 2 Mar 6 10:37 qq-cw-transaction-article-sync-58-1583462261.txt
-rw-r--r-- 1 root root 2 Mar 6 10:38 qq-cw-transaction-article-sync-57-1583462323.txt
-rw-r--r-- 1 root root 2 Mar 6 10:38 qq-cw-transaction-article-sync-59-1583462324.txt
-rw-r--r-- 1 root root 2 Mar 6 10:38 qq-cw-transaction-article-sync-68-1583462324.txt
-rw-r--r-- 1 root root 2 Mar 6 10:38 qq-cw-transaction-article-sync-58-1583462324.txt
-rw-r--r-- 1 root root 2 Mar 6 10:39 qq-cw-transaction-article-sync-64-1583462386.txt
-rw-r--r-- 1 root root 2 Mar 6 10:39 qq-cw-transaction-article-sync-57-1583462386.txt
-rw-r--r-- 1 root root 2 Mar 6 10:39 qq-cw-transaction-article-sync-69-1583462386.txt
-rw-r--r-- 1 root root 2 Mar 6 10:39 qq-cw-transaction-article-sync-58-1583462386.txt
-rw-r--r-- 1 root root 2 Mar 6 10:40 qq-cw-transaction-article-sync-65-1583462448.txt
-rw-r--r-- 1 root root 2 Mar 6 10:40 qq-cw-transaction-article-sync-57-1583462448.txt
-rw-r--r-- 1 root root 2 Mar 6 10:40 qq-cw-transaction-article-sync-63-1583462449.txt
-rw-r--r-- 1 root root 2 Mar 6 10:40 qq-cw-transaction-article-sync-68-1583462449.txt
-rw-r--r-- 1 root root 2 Mar 6 10:40 qq-cw-transaction-article-sync-58-1583462449.txt
-rw-r--r-- 1 root root 2 Mar 6 10:41 qq-cw-transaction-article-sync-69-1583462511.txt
-rw-r--r-- 1 root root 2 Mar 6 10:41 qq-cw-transaction-article-sync-63-1583462511.txt
-rw-r--r-- 1 root root 2 Mar 6 10:41 qq-cw-transaction-article-sync-68-1583462512.txt
-rw-r--r-- 1 root root 2 Mar 6 10:41 qq-cw-transaction-article-sync-59-1583462512.txt
-rw-r--r-- 1 root root 2 Mar 6 10:41 qq-cw-transaction-article-sync-65-1583462512.txt








