Skip to content

Commit

Permalink
A raw network sender, to try sending and receiving without (necessari…
Browse files Browse the repository at this point in the history
…ly) streams in the middle
  • Loading branch information
Michael Bridgen committed Sep 9, 2009
1 parent 34f0e98 commit 9240a4b
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/performance/src/raw_network_sender.py
@@ -0,0 +1,11 @@
from net.grinder.script.Grinder import grinder
from sender_grinder_util import SenderTestRunner
from sender import NetworkSender

HOST = grinder.properties.getProperty("streams.test.host")
PORT = int(grinder.properties.getProperty("streams.test.port"))

class TestRunner(SenderTestRunner):
def __init__(self):
netSender = NetworkSender((HOST, PORT))
SenderTestRunner.__init__(self, netSender)
16 changes: 16 additions & 0 deletions test/performance/src/sender.py
@@ -1,5 +1,7 @@
from net.grinder.plugin.http import HTTPRequest

import socket

# TODO: Remove duplication
def consoleLog(msg):
print msg
Expand Down Expand Up @@ -28,3 +30,17 @@ def send(self, data):
raise Exception("Unexpected HTTP response; " + result.getText())

return result

class NetworkSender(Sender):
def __init__(self, addr):
self._addr = addr
Sender.__init__(self)
self.log("Using address %r" % (addr,))

def send(self, data):
sock = socket.socket()
sock.connect(self._addr)
sock.sendall(data)
sock.close()


31 changes: 31 additions & 0 deletions test/performance/tests/net_to_net/receiver.properties
@@ -0,0 +1,31 @@
grinder.script = ../../src/raw_network_receiver.py

# The number of worker processes each agent should start. This must be 1 unless
# you have an affinity for "socket in use" errors
grinder.processes = 1

# The number of worker threads each worker process should start. This has only
# been tested with a value of 1 but theoretically this will clear the received
# message queue using multiple threads.
grinder.threads = 1

# The number of runs each worker process will perform. 0 means run for ever.
# This can be synchronized with the sender test to automatically exit when a
# known number of messages have been received
grinder.runs = 100000

# Disable use of the console. The receiver must be running before the
# Orchestrator is started, and the sending tests obviously rely on that
# therefore this dependency must be managed externally
grinder.useConsole=false

# The port to listen to. Defaults to 55555
streams.test.port=12345

# The host of the shared message store. This must be the same as used by the
# sender. The default is 127.0.0.1
streams.test.msg_store.host=127.0.0.1

# The port of the shared message store. This must be the same as used by the
# sender. The default is 11211
streams.test.msg_store.port=11211
55 changes: 55 additions & 0 deletions test/performance/tests/net_to_net/sender.properties
@@ -0,0 +1,55 @@
# The file name of the script to run.
#
# Relative paths are evaluated from the directory containing the
# properties file. The default is "grinder.py".
grinder.script = ../../src/raw_network_sender.py

# The number of worker processes each agent should start. The default
# is 1.
grinder.processes = 1

# The number of worker threads each worker process should start. The
# default is 1.
grinder.threads = 1

# The number of runs each worker process will perform. When using the
# console this is usually set to 0, meaning "run until the console
# sneds a stop or reset signal". The default is 1.
grinder.runs = 100000

# The IP address or host name that the agent and worker processes use
# to contact the console. The default is all the network interfaces
# of the local machine.
; grinder.consoleHost = consolehost

# The IP port that the agent and worker processes use to contact the
# console. Defaults to 6372.
; grinder.consolePort

# The host of the shared message store. This must be the same as used by the
# sender. The default is 127.0.0.1
streams.test.msg_store.host=127.0.0.1

# The port of the shared message store. This must be the same as used by the
# sender. The default is 11211
streams.test.msg_store.port=11211

# The host and port to send requests to. Mandatory parameter.
streams.test.host=127.0.0.1
streams.test.port=12345

# The target number of messages per second to send per thread.
# 0 is no target rate, i.e., go as fast as possible
streams.test.msg_rate=100

# The file containing the message set to send. Each line in the file is treated
# as a message. There is no default value.
streams.test.message_set_file=test/performance/src/test-messages.txt

# The regular expression to use to extract messages from the source file. The
# default is <label network=".*">(.*)</label>
#streams.test.extract_msg_re=

# The regular expression to use to insert an ID into a message. The default is
# $, i.e., at the end of the message
#streams.test.insert_id_re=

0 comments on commit 9240a4b

Please sign in to comment.