Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubiquity-workerman (incredible) results in last run #5118

Closed
jcheron opened this issue Oct 6, 2019 · 10 comments
Closed

Ubiquity-workerman (incredible) results in last run #5118

jcheron opened this issue Oct 6, 2019 · 10 comments

Comments

@jcheron
Copy link
Contributor

jcheron commented Oct 6, 2019

I wish that were true,
The Ubiquity-workerman couple would be the fastest on the Multiple queries test (see 42f65a64-69b2-400d-b24e-20ecec9848bc).
Ubiquity is fast, and so is Workerman. But it seems more than unlikely that the workerman-raw version will be slower than the one associated with a Framework (even if Ubiquity uses Mysqli, and workerman PDO), and this is not the only point of comparison that can raise suspicion...

I didn't see anything suspicious in the query raw file.
The logs just indicate an error that occurred on 1 worker

I'll try to investigate this on my side...

@joanhey
Copy link
Contributor

joanhey commented Oct 7, 2019

Well Kumbia-Workerman will be faster :) jeje

@joanhey
Copy link
Contributor

joanhey commented Oct 7, 2019

We will check #5122 results in the next run in the plain Workerma with Mysqli.
If the results are good, will benefit any framework using Mysqli.

@jcheron
Copy link
Contributor Author

jcheron commented Oct 8, 2019

So there was a problem in the Ubiquity-workerman tests, not revealed by the initial test phase, nor by the logs in the last run.
A good part of the Db queries were not executed, as soon as the concurrency level increased.

To confirm that, I made a script checking that the number of Db queries executed, and that the number of rows read on the server side corresponds to the executed code, at a given concurrency level.
In principle:

  • I store the initial values on the DB side.
  • I clear the cache of requests.
  • I run a test (ab or wrk) with xx requests and a certain level of concurrent access.
  • I measure the values again and compare the difference with an expected yy number.

For Mysql, my script looks like this:

class QueriesCheck {
	/**
	 * @var Database
	 */
	private $db;
	public function __construct($dbOffset='default'){
		$this->db=Database::start($dbOffset);
	}
	public function run($url,$concurrency=512,$count=15000,$expectedQueries=15000,$expectedRows=15000):void{
		$queries=$this->getQueries();
		$rows=$this->getRows();
		$this->resetCache();
		
		\passthru("ab -c $concurrency -n $count $url");
		
		$queries=$this->getQueries()-$queries;
		$rows=$this->getRows()-$rows;
		$message="queries: $queries/$expectedQueries, rows: $rows/$expectedRows";
		if($rows<$expectedRows || $queries<$expectedQueries){
			throw new \RuntimeException("Problem: ".$message);
		}
		echo $message;
	}
	
	public function getQueries():int{
		return $this->db->queryColumn("Show session status like 'Queries';",1);
	}
	
	public function getRows():int{
		return $this->db->queryColumn("show session status like 'Innodb_rows_read';",1);
	}
	
	public function resetCache():void{
		$this->db->query('RESET QUERY CACHE;');
	}
}
(new QueriesCheck())->run($argv[1],$argv[2]??512,$argv[3]??15000,$argv[4]??15000,$argv[5]??15000);

It would be nice if Techempower had a Python equivalent for checking our tests.
I'm not sure that my inglorious test in the last run will raise any suspicion about the results of the runs in the future.
Such a verification (as I have not seen anywhere in the existing code) would give even more credibility to our results.

@joanhey
Copy link
Contributor

joanhey commented Oct 8, 2019

It's difficult as the benchmark is by time, but it can be done

@joanhey
Copy link
Contributor

joanhey commented Oct 8, 2019

I find more information, that normally the bench don't check.

Workerman Mysql

https://tfb-status.techempower.com/unzip/results.2019-10-05-23-14-37-606.zip/results/20191002030153/workerman/db/raw.txt

---------------------------------------------------------
 Concurrency: 512 for db
 wrk -H 'Host: 10.0.0.1' -H 'Accept: application/json,text/html;q=0.9,application/xhtml+xml;q=0.9,application/xml;q=0.8,*/*;q=0.7' -H 'Connection: keep-alive' --latency -d 15 -c 512 --timeout 8 -t 28 "http://10.0.0.1:8080/db"
---------------------------------------------------------
Running 15s test @ http://10.0.0.1:8080/db
  28 threads and 512 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     2.04ms    1.00ms  25.67ms   68.82%
    Req/Sec     8.94k   789.74    13.83k    70.08%
  Latency Distribution
     50%    1.92ms
     75%    2.61ms
     90%    3.36ms
     99%    4.94ms
  3758506 requests in 15.10s, 676.65MB read
Requests/sec: 248912.94
Transfer/sec:     44.81MB
STARTTIME 1570333962
ENDTIME 1570333977

Ubiquity-workerman with Mysqli

https://tfb-status.techempower.com/unzip/results.2019-09-27-18-21-14-704.zip/results/20190923214828/ubiquity-workerman/db/raw.txt

---------------------------------------------------------
 Concurrency: 512 for db
 wrk -H 'Host: 10.0.0.1' -H 'Accept: application/json,text/html;q=0.9,application/xhtml+xml;q=0.9,application/xml;q=0.8,*/*;q=0.7' -H 'Connection: keep-alive' --latency -d 15 -c 512 --timeout 8 -t 28 "http://10.0.0.1:8080/WorkerDb"
---------------------------------------------------------
Running 15s test @ http://10.0.0.1:8080/WorkerDb
  28 threads and 512 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    20.02ms   28.53ms 114.31ms   81.56%
    Req/Sec     3.06k   518.41     5.53k    69.69%
  Latency Distribution
     50%    3.35ms
     75%   32.29ms
     90%   70.14ms
     99%  100.32ms
  1283671 requests in 15.10s, 229.88MB read
  Socket errors: connect 0, read 1283659, write 0, timeout 0
Requests/sec:  85012.34
Transfer/sec:     15.22MB
STARTTIME 1569595253
ENDTIME 1569595268

The sockets errors are never show like errors.
I think that it is important to know if a framework have socket errors, and will be show in the visualize table.

Comparison db with 512 concurrent.

Wrk Ubiquity-Workerman Workerman
Socket errors read 1,283,659 0
Mb read 229.88 676.65
Total requests 1,283,671 3,758,506
Requests/sec 85,012.34 248,912.94
Show in vizualize req/s 402,397 250,567

What we see:

Screenshot_20191008114135

https://www.techempower.com/benchmarks/#section=test&runid=42f65a64-69b2-400d-b24e-20ecec9848bc&hw=ph&test=db&p=zik0zj-zik0zj-zik0zj-zik0zj-d

The results are completely different from wrk and what we see.

@jcheron
Copy link
Contributor Author

jcheron commented Oct 8, 2019

On the run of the 2019-09-23 where Ubiquity-workerman generated socket errors,
see https://tfb-status.techempower.com/unzip/results.2019-09-27-18-21-14-704.zip/results/20190923214828/ubiquity-workerman/query/raw.txt

The results showed that these errors were present:

image

@jcheron
Copy link
Contributor Author

jcheron commented Oct 8, 2019

It's difficult as the benchmark is by time, but it can be done

I'm not talking about doing this check during the benchmark, but beforehand, when using the verify mode of the tfb script:

./tfb --mode verify --test XFramework

In the verify mode, we could integrate the checking of the actual number of database queries performed:
We make an ab with 10,000 requests, at the desired concurrency level:

ab -c 512 -n 10000 $url

We then check that the number of queries and the number of lines read from the DB is at least 20*10,000 if the test is multiple queries (/query/20).
This is what my php script does.

@joanhey
Copy link
Contributor

joanhey commented Oct 8, 2019

The visualize only show the >300 errors, never the socket errors.
In the table you see the errors from php:
https://tfb-status.techempower.com/unzip/results.2019-09-27-18-21-14-704.zip/results/20190923214828/ubiquity-workerman/run/ubiquity-workerman.log

If show the socket errors it will be always present for any framework.

I hope that it will be present the socket errors, not only the errors from the language or server.
Really only the languages that show an error with the status return response.

@jcheron
Copy link
Contributor Author

jcheron commented Oct 8, 2019

You have the wrong Run, between your table (run of 2019-09-23)
image

And the results table you showed (run of 2019-10-01)

The results of the 2019-09-23 run are in line with the expectations:
image

And this is also the case for the 2019-10-01 run;
The results are about the same between wrk and what we can see

wrk for the run 2019-10-01 Db/query

---------------------------------------------------------
 Concurrency: 512 for db
 wrk -H 'Host: 10.0.0.1' -H 'Accept: application/json,text/html;q=0.9,application/xhtml+xml;q=0.9,application/xml;q=0.8,*/*;q=0.7' -H 'Connection: keep-alive' --latency -d 15 -c 512 --timeout 8 -t 28 "http://10.0.0.1:8080/WorkerDb"
---------------------------------------------------------
Running 15s test @ http://10.0.0.1:8080/WorkerDb
  28 threads and 512 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     1.26ms  562.28us  27.07ms   89.72%
    Req/Sec    14.36k     1.50k   20.05k    68.17%
  Latency Distribution
     50%    1.22ms
     75%    1.43ms
     90%    1.61ms
     99%    2.90ms
  6035957 requests in 15.10s, 1.51GB read
Requests/sec: 399730.58
Transfer/sec:    102.55MB
STARTTIME 1570303158
ENDTIME 1570303173

Displayed as

image

@joanhey
Copy link
Contributor

joanhey commented Oct 8, 2019

Yes, my fault. (Monday !!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants