Example #1
0
 def main(self):
     while True:
         try:
             self.server.hub.deliver(RandomMessage.generate())
         except socket.error:
             pass
         time.sleep(random.uniform(0, 7))
Example #2
0
    def benchmark(self):
        """Reset the database, start the server, run a benchmark on it,
           and shut it down. Returns a (messages/sec, resident bytes) tuple.
           """
        self.initDatabase()
        self.startServer()
        time.sleep(3)

        server = xmlrpclib.ServerProxy("http://localhost:3910", allow_none=True)
        self.loadRulesets(server)

        speed = RandomMessage.benchmark(server)
        memory = getProcRSS(self.pid)

        self.stopServer()

        return (speed, memory)