intel / asynch_mode_nginx

Other
210 stars 60 forks source link

Nearly no difference with Internal and Heuristic #2

Closed jiavictor closed 5 years ago

jiavictor commented 5 years ago

Hello Team,

I had configured asynch_mode_nginx with Internal and Heuristic of poll mode and did some tests, but the results were nearly the same.

With Internal, the result was 41575.35, and with Heuristic, the result was 41613.51.

My question is that what is the different between Internal and Heuristic and what we can benefit from Heuristic?

Thanks in advance.

My testing script:

#!/bin/bash
ab_path=/usr/bin
cpu=`cat /proc/cpuinfo | grep processor | wc -l `
count=${1-$cpu}
for ((i=0; i<$count; i++))
    do
        $ab_path/ab -n 40960 -c 48 -Z AES128-SHA https://127.0.0.1/ > $i.txt &
done
wait
total=0
for ((i=0; i<$count; i++))
    do
        cur=`cat $i.txt  | grep "Requests per second" | tr -s " " | cut -d" " -f 4`
        echo "test$i=$cur"
        if [[ $cur == "" ]]
            then
                echo "error on $i"
            exit
        fi
        total=$(echo "$total+$cur" | bc)
done
echo "-------------"
echo total=$total
WenqianYu commented 5 years ago

Hello, @jiavictor ,

What platform are you using? Is that Intel(R) DH895XCC card? The maximum performance for RSA on this card is about 40K ops.

Using heuristic, the performance will be improved compared with internal polling when the performance is not peak.

Kind Regards,

weicz11 commented 5 years ago

Hello, @jiavictor ,

What platform are you using? Is that Intel(R) DH895XCC card? The maximum performance for RSA on this card is about 40K ops.

Using heuristic, the performance will be improved compared with internal polling when the performance is not peak.

Kind Regards,

  • Wenqian

Yes, wenqian is right. @jiavictor , if you want to compare the difference between the two modes, you can try to start less workers such as 2 nginx workers, push the worker CPU usage to 100%, then you can get the performance difference (both modes cannot reach the peak performance ~40K, but you can find that heuristic polling will get higher performance). In other words, you can get the same peak performance with less process (CPU cores) when you enable heuristic polling. However, heuristic polling has some parameters such as the threshold which may need to be tuned on your platform to get the best performance, since it depends on your platform (such as CPU), for a simplicity comparison, you can compare the internal polling and external polling. From the performance perspective, external polling and heuristic polling is the same. Heuristic polling will have the least latency for each single connection comparing with external polling. That's the only difference between heuristic and external polling, they are both better than internal polling when you are caring about performance.

jiavictor commented 5 years ago

Hello @WenqianYu @weicz11 I have a 8950.

My testing results are opposite. Internal is higher and heuristic is less for both high and low loads. But, heuristic is more stable even with full loads and internal may reports errors. So I will choose heuristic for Nginx.

Thanks a lot.