def _wsgi_benchmark_server(lock, port): grpc_wsgi_app = sonora.wsgi.grpcWSGI(None) benchmark_pb2_grpc.add_BenchmarkServiceServicer_to_server( SyncBenchmark(), grpc_wsgi_app) bjoern.listen(grpc_wsgi_app, "localhost", port) lock.release() bjoern.run()
def _grpcio_benchmark_server(lock, port): server = grpc.server(futures.ThreadPoolExecutor(max_workers=1)) benchmark_pb2_grpc.add_BenchmarkServiceServicer_to_server( SyncBenchmark(), server) server.add_insecure_port(f"localhost:{port}") lock.release() server.start() server.wait_for_termination()
def _asgi_benchmark_server(lock, port): grpc_asgi_app = sonora.asgi.grpcASGI() benchmark_pb2_grpc.add_BenchmarkServiceServicer_to_server( AsyncBenchmark(), grpc_asgi_app) lock.release() uvicorn.run(grpc_asgi_app, host="127.0.0.1", port=port, log_level="info", access_log=False)