Created
January 8, 2019 00:47
-
-
Save ProdigyView/94c3ab0e39c3c2ab9fa5f1ad1d4759fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include ('vendor/autoload.php'); | |
use prodigyview\network\Curl; | |
use prodigyview\network\Socket; | |
use prodigyview\system\Security; | |
echo "\nStarting Route Speed Tests\n\n"; | |
$request = 100; | |
$data = array('test' => 'string','ofdata' => 'to send'); | |
Security::init(); | |
//POST Request to endpoint | |
$start = microtime(true); | |
for($i =0; $i<$request; $i++) { | |
$curl = new Curl('127.0.0.1:8000/callme'); | |
$curl->send('post',$data ); | |
$curl->getResponse(); | |
} | |
echo 'HTTP Routing Time: ' . (microtime(true) - $start) . "\n"; | |
//GET Request to endpoint | |
$start = microtime(true); | |
for($i =0; $i<$request; $i++) { | |
$curl = new Curl('http://127.0.0.1:8000/get.php'); | |
$curl->send('get',$data ); | |
$curl->getResponse(); | |
} | |
echo 'HTTP GET Time (No Routing): ' . (microtime(true) - $start) . "\n"; | |
//Socket Request | |
$start = microtime(true); | |
for($i =0; $i<$request; $i++) { | |
//Connect To Server 1, send message | |
$socket = new Socket('localhost', 8650, array('connect' => true)); | |
$message = Security::encrypt(json_encode($data)); | |
$response = $socket->send($message); | |
$socket->close(); | |
} | |
echo 'Socket Test Time: ' . (microtime(true) - $start) . "\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment