Skip to content

wedgwood/serverbench.php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

serverbench.php


Requirements

example

<?php
require 'libserverbench.phar';

$server = new \ServerBench\App\Server\Server('tcp://127.0.0.1:12345', function ($msg) {
	return $msg;
});

$daemon = false;
$server->run($daemon);
#cli utils

#start
php serverbench.phar --pidfile=./pid --dir=./ --app=app.php -c app.ini --daemon

#stop
php serverbench.phar --stop --pidfile=./pid

#reload
php serverbench.phar --reload --pidfile=./pid

#status
php serverbench.phar --status --pidfile=./pid
<?php
// app entrance
class App
{
	public function init()
	{
		// connect database or anything else to ready
	}

	public function fini()
	{
		// do something to clean up
	}

	public function process($msg)
	{
		// process msg from client
		// here is an echo server
		return $msg;
	}
}

return new App();
# php benchmark.php -C {address to connect} -c {clients/concurrency}  -T {time to testing} -L {msg's length}
php benchmark.php -C tcp://127.0.0.1:12345 -c 300 -T 15 -L 100

About

process pool pattern service server implementation in php

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published