Open Bidder Webserver Stack

Web stack and APIs

Open Bidder is in part a webserver. The tasks of accepting connections, processing HTTP, and dispatching requests, are implemented with the help of Netty, an asynchronous, event-driven, high-performance networking library. But Netty is not compatible with the familiar Servlet API, and its own internal APIs trade simplicity and usability for maximum performance (e.g., managing native memory buffers to reduce GC and JNI costs). So Open Bidder includes high-level APIs for things like HTTP messages, cookies, request handlers, and simple HTML templating.

For example, here's the code for a simple ping service (check here for a complete guide):

public class PingRequestReceiver implements HttpReceiver {
  @Override public void receive(HttpReceiverContext ctx) {
    ctx.httpResponse().contentWriter().print("pong");
  }
}

Custom HTTP endpoints are a rare need, but it's more frequent for user code to access transport information like HTTP parameters or cookies. This uses Open Bidder's http package too. The UserRequest class (root of all Open Bidder requests) offers a httpRequest() method, and UserResponse (root of all responses) has httpResponse().

In our internal benchmarking, the bidder exhibited high performance and scalability, serving 20,000 QPS on a single 4-core machine with response latencies below 10 ms. This is of course for a test without any realistic bidding logic, so your results will vary with the amount of processing and I/O you perform per request.

Enviar comentarios sobre…