Last active
December 27, 2015 07:49
-
-
Save desarrolla2/7292168 to your computer and use it in GitHub Desktop.
performance comparison mysql / doctrine vs ranbbit mq. The aim is to compare which is the performance difference between leaving a message on rabbit, or create a record in mysql. Doctrine and Rabbit are not the same technology, but we want to compare which is the performance difference, to know whether in a particular case, we should introduce r…
This file contains hidden or 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 | |
namespace Desarrolla2\Bundle\AnalyticsBundle\Controller; | |
use Symfony\Bundle\FrameworkBundle\Controller\Controller; | |
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | |
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; | |
use Symfony\Component\HttpFoundation\JsonResponse; | |
use Desarrolla2\Bundle\AnalyticsBundle\Entity\Data; | |
/** | |
* @Route("/") | |
*/ | |
class DefaultController extends Controller | |
{ | |
/** | |
* @Route("/rabbitmq") | |
* @Template() | |
*/ | |
public function index1Action() | |
{ | |
$this->get( | |
'old_sound_rabbit_mq.analytics_producer' | |
)->publish($this->getMessage()); | |
return new JsonResponse(); | |
} | |
/** | |
* @Route("/doctrine") | |
* @Template() | |
*/ | |
public function index2Action() | |
{ | |
$em = $this->getDoctrine()->getManager(); | |
$data = new Data(); | |
$data->setDescription($this->getMessage()); | |
$em->persist($data); | |
$em->flush(); | |
return new JsonResponse(); | |
} | |
/** | |
* @return string | |
*/ | |
protected function getMessage() | |
{ | |
return serialize( | |
array( | |
'id' => 1, | |
'name' => 'Daniel', | |
) | |
); | |
} | |
} |
This file contains hidden or 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
We are using a fresh instalation of Symfony2.3 | |
## Doctrine | |
ab -n 500 -c 10 http://test.local/analytics/doctrine | |
Document Path: /analytics/doctrine | |
Document Length: 2 bytes | |
Requests per second: 20.81 [#/sec] (mean) | |
Time per request: 480.456 [ms] (mean) | |
Time per request: 48.046 [ms] (mean, across all concurrent requests) | |
Transfer rate: 5.53 [Kbytes/sec] received | |
Percentage of the requests served within a certain time (ms) | |
50% 465 | |
66% 479 | |
75% 490 | |
80% 498 | |
90% 522 | |
95% 540 | |
98% 618 | |
99% 680 | |
100% 714 (longest request) | |
## RabbitMQ | |
ab -n 500 -c 10 http://test.local/analytics/rabbitmq | |
Document Path: /analytics/rabbitmq | |
Document Length: 2 bytes | |
Requests per second: 52.04 [#/sec] (mean) | |
Time per request: 192.152 [ms] (mean) | |
Time per request: 19.215 [ms] (mean, across all concurrent requests) | |
Transfer rate: 13.82 [Kbytes/sec] received | |
Percentage of the requests served within a certain time (ms) | |
50% 189 | |
66% 196 | |
75% 201 | |
80% 204 | |
90% 213 | |
95% 222 | |
98% 240 | |
99% 274 | |
100% 321 (longest request) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment