Java Code Examples for com.baidu.brpc.server.RpcServerOptions#setSendBufferSize()

The following examples show how to use com.baidu.brpc.server.RpcServerOptions#setSendBufferSize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DubboServer.java    From brpc-java with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
    RpcServerOptions serverOptions = new RpcServerOptions();
    serverOptions.setProtocolType(Options.ProtocolType.PROTOCOL_DUBBO_VALUE);
    serverOptions.setNamingServiceUrl("dubbo://127.0.0.1:2181");
    serverOptions.setReceiveBufferSize(64 * 1024 * 1024);
    serverOptions.setSendBufferSize(64 * 1024 * 1024);
    serverOptions.setWorkThreadNum(12);

    RpcServer rpcServer = new RpcServer(8898, serverOptions);
    EchoService service = new EchoServiceImpl();

    NamingOptions namingOptions = new NamingOptions();
    namingOptions.setGroup("");
    namingOptions.setVersion("");
    rpcServer.registerService(service, namingOptions);
    rpcServer.start();

    // make server keep running
    synchronized (DubboServer.class) {
        try {
            DubboServer.class.wait();
        } catch (Throwable e) {
        }
    }
}
 
Example 2
Source File: RpcServerTest.java    From brpc-java with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
        int port = 8002;
        if (args.length == 1) {
            port = Integer.valueOf(args[0]);
        }

        RpcServerOptions options = new RpcServerOptions();
        options.setReceiveBufferSize(64 * 1024 * 1024);
        options.setSendBufferSize(64 * 1024 * 1024);
        options.setKeepAliveTime(20);
//        options.setNamingServiceUrl("consul://127.0.0.1:8500");
//        final RpcServer rpcServer = new RpcServer(port, options);
        final RpcServer rpcServer = new RpcServer(port, options);
        rpcServer.registerService(new EchoServiceImpl());
        rpcServer.start();

        // make server keep running
        synchronized (RpcServerTest.class) {
            try {
                RpcServerTest.class.wait();
            } catch (Throwable e) {
            }
        }
    }
 
Example 3
Source File: RpcServerTest.java    From brpc-java with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
        int port = 8002;
        if (args.length == 1) {
            port = Integer.valueOf(args[0]);
        }

        RpcServerOptions options = new RpcServerOptions();
//        options.setAcceptorThreadNum(8);
//        options.setIoThreadNum(32);
//        options.setWorkThreadNum(80);
        options.setReceiveBufferSize(64 * 1024 * 1024);
        options.setSendBufferSize(64 * 1024 * 1024);
        RpcServer rpcServer = new RpcServer(port, options);
        rpcServer.registerService(new EchoServiceImpl());
        rpcServer.start();

        // make server keep running
        synchronized (RpcServerTest.class) {
            try {
                RpcServerTest.class.wait();
            } catch (Throwable e) {
                // ignore
            }
        }
    }
 
Example 4
Source File: Server.java    From rpc-benchmark with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws InterruptedException {
    int port = 8002;

    RpcServerOptions options = new RpcServerOptions();
    options.setReceiveBufferSize(64 * 1024 * 1024);
    options.setSendBufferSize(64 * 1024 * 1024);
    options.setKeepAliveTime(20);
    options.setProtocolType(Options.ProtocolType.PROTOCOL_HTTP_JSON_VALUE);

    final RpcServer rpcServer = new RpcServer(port, options);
    rpcServer.registerService(new UserServiceServerImpl());
    rpcServer.start();

    System.out.println("START");
    Thread.sleep(Long.MAX_VALUE);
}
 
Example 5
Source File: BaiduBrpcApplication.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public void afterPropertiesSet() throws Exception {
    int port = 1118;
    RpcServerOptions options = new RpcServerOptions();
    options.setReceiveBufferSize(64 * 1024 * 1024);
    options.setSendBufferSize(64 * 1024 * 1024);
    options.setKeepAliveTime(20);
    final RpcServer rpcServer = new RpcServer(port, options);
    rpcServer.registerService(new EchoServiceImpl());
    rpcServer.start();
}