Skip to content

Instantly share code, notes, and snippets.

@lukebakken
Last active December 27, 2017 22:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukebakken/e5719637931d7122940dfb0f1b128d54 to your computer and use it in GitHub Desktop.
Save lukebakken/e5719637931d7122940dfb0f1b128d54 to your computer and use it in GitHub Desktop.
queue-index-disk-space-VuICv0AMzKo

PerfTest

--uri amqp://localhost:5672 --producers 1 --consumers 0 \
    --size 2048 --predeclared --exchange exchange-VuICv0AMzKo \
    --routing-key VuICv0AMzKo --flag persistent --rate 1024
#!/usr/bin/env bash
set -o errexit
set -o nounset
declare -r routing_key='VuICv0AMzKo'
declare -r exch_name="exchange-$routing_key"
echo -n Declaring exchange $exch_name...
rabbitmqadmin declare exchange name="$exch_name" type=topic durable=true
echo Done.
declare -ir batch_sz=32
declare -i idx=0
for ((i = 0; i < 1024; i=i+batch_sz))
do
for ((j = 0; j < batch_sz; j++))
do
idx="$((i + j))"
{
q_name="queue-$idx"
echo -n Declaring queue $q_name...
rabbitmqadmin declare queue name="$q_name" durable=true
echo Done.
echo -n Binding queue $q_name to exchange $exch_name...
rabbitmqadmin declare binding source="$exch_name" destination="$q_name" routing_key="$routing_key"
echo Done.
} &
done
wait
done
echo -n Declaring policy...
rabbitmqadmin declare policy name=queue-length pattern='^queue-' definition='{"max-length":32}' priority=999 apply-to=queues
echo Done.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment