Skip to content

Commit

Permalink
fix benchmark scripts, increase message counts
Browse files Browse the repository at this point in the history
  • Loading branch information
ramunasd committed Dec 15, 2022
1 parent 0b392be commit 2a4cd8e
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 26 deletions.
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ docs:
php -d error_reporting=0 ./phpDocumentor.phar run -v --force --defaultpackagename=PhpAmqpLib --title='php-amqplib' -d ./PhpAmqpLib -t ./docs
.PHONY: benchmark
benchmark:
@echo "Publishing 4000 msgs with 1KB of content:"
php benchmark/producer.php 4000
@echo "Consuming 4000:"
@echo "Publishing 10k messages with 1KB of content:"
php benchmark/producer.php 10000
@echo "Consuming:"
php benchmark/consumer.php
@echo "Stream produce 100:"
php benchmark/stream_tmp_produce.php 100
@echo "Socket produce 100:"
php benchmark/socket_tmp_produce.php 100
@echo "Stream produce 1k:"
php benchmark/stream_tmp_produce.php 1000
@echo "Socket produce 1k:"
php benchmark/socket_tmp_produce.php 1000
12 changes: 0 additions & 12 deletions benchmark/config.php

This file was deleted.

6 changes: 4 additions & 2 deletions benchmark/consumer.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<?php

use PhpAmqpLib\Connection\AMQPConnection;
use PhpAmqpLib\Connection\AMQPStreamConnection;

require_once __DIR__ . '/config.php';
require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/../tests/config.php';

$exchange = 'bench_exchange';
$queue = 'bench_queue';
$consumer_tag = '';

$conn = new AMQPConnection(HOST, PORT, USER, PASS, VHOST);
$conn = new AMQPStreamConnection(HOST, PORT, USER, PASS, VHOST);
$ch = $conn->channel();

$ch->queue_declare($queue, false, false, false, false);
Expand Down
3 changes: 2 additions & 1 deletion benchmark/file_consume.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

use PhpAmqpLib\Connection\AMQPConnection;

require_once __DIR__ . '/config.php';
require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/../tests/config.php';

$exchange = 'file_exchange';
$queue = 'file_queue';
Expand Down
3 changes: 2 additions & 1 deletion benchmark/file_publish.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
use PhpAmqpLib\Connection\AMQPConnection;
use PhpAmqpLib\Message\AMQPMessage;

require_once __DIR__ . '/config.php';
require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/../tests/config.php';

//suboptimal function to generate random content
function generate_random_content($bytes)
Expand Down
3 changes: 2 additions & 1 deletion benchmark/producer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Message\AMQPMessage;

include(__DIR__ . '/config.php');
require __DIR__ . '/../vendor/autoload.php';
include __DIR__ . '/../tests/config.php';

$exchange = 'bench_exchange';
$queue = 'bench_queue';
Expand Down
3 changes: 2 additions & 1 deletion benchmark/socket_tmp_produce.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
use PhpAmqpLib\Connection\AMQPSocketConnection;
use PhpAmqpLib\Message\AMQPMessage;

require_once __DIR__ . '/config.php';
require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/../tests/config.php';

$conn = new AMQPSocketConnection(HOST, PORT, USER, PASS, VHOST);

Expand Down
3 changes: 2 additions & 1 deletion benchmark/stream_tmp_produce.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Message\AMQPMessage;

require_once __DIR__ . '/config.php';
require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/../tests/config.php';

$conn = new AMQPStreamConnection(HOST, PORT, USER, PASS, VHOST);

Expand Down

0 comments on commit 2a4cd8e

Please sign in to comment.