nghttpx: Use smaller buffer for reading

This commit is contained in:
Tatsuhiro Tsujikawa 2015-01-08 21:28:52 +09:00
parent a41b7baf81
commit 5473e870eb
3 changed files with 14 additions and 12 deletions

View File

@ -902,9 +902,9 @@ void ClientHandler::write_accesslog(int major, int minor, unsigned int status,
WorkerStat *ClientHandler::get_worker_stat() const { return worker_stat_; } WorkerStat *ClientHandler::get_worker_stat() const { return worker_stat_; }
UpstreamBuf *ClientHandler::get_wb() { return &wb_; } ClientHandler::WriteBuf *ClientHandler::get_wb() { return &wb_; }
UpstreamBuf *ClientHandler::get_rb() { return &rb_; } ClientHandler::ReadBuf *ClientHandler::get_rb() { return &rb_; }
void ClientHandler::signal_write() { wlimit_.startw(); } void ClientHandler::signal_write() { wlimit_.startw(); }

View File

@ -48,8 +48,6 @@ class ConnectBlocker;
class DownstreamConnectionPool; class DownstreamConnectionPool;
struct WorkerStat; struct WorkerStat;
typedef RingBuf<65536> UpstreamBuf;
class ClientHandler { class ClientHandler {
public: public:
ClientHandler(struct ev_loop *loop, int fd, SSL *ssl, const char *ipaddr, ClientHandler(struct ev_loop *loop, int fd, SSL *ssl, const char *ipaddr,
@ -137,8 +135,11 @@ public:
int64_t body_bytes_sent); int64_t body_bytes_sent);
WorkerStat *get_worker_stat() const; WorkerStat *get_worker_stat() const;
UpstreamBuf *get_wb(); using WriteBuf = RingBuf<65536>;
UpstreamBuf *get_rb(); using ReadBuf = RingBuf<8192>;
WriteBuf *get_wb();
ReadBuf *get_rb();
RateLimit *get_rlimit(); RateLimit *get_rlimit();
RateLimit *get_wlimit(); RateLimit *get_wlimit();
@ -176,8 +177,8 @@ private:
bool should_close_after_write_; bool should_close_after_write_;
bool tls_handshake_; bool tls_handshake_;
bool tls_renegotiation_; bool tls_renegotiation_;
UpstreamBuf wb_; WriteBuf wb_;
UpstreamBuf rb_; ReadBuf rb_;
}; };
} // namespace shrpx } // namespace shrpx

View File

@ -52,8 +52,6 @@ struct StreamData {
class Http2Session { class Http2Session {
public: public:
typedef RingBuf<65536> Buf;
Http2Session(struct ev_loop *loop, SSL_CTX *ssl_ctx); Http2Session(struct ev_loop *loop, SSL_CTX *ssl_ctx);
~Http2Session(); ~Http2Session();
@ -170,6 +168,9 @@ public:
CONNECTION_CHECK_STARTED CONNECTION_CHECK_STARTED
}; };
using ReadBuf = RingBuf<8192>;
using WriteBuf = RingBuf<65536>;
private: private:
ev_io wev_; ev_io wev_;
ev_io rev_; ev_io rev_;
@ -200,8 +201,8 @@ private:
int connection_check_state_; int connection_check_state_;
bool flow_control_; bool flow_control_;
bool write_requested_; bool write_requested_;
Buf wb_; WriteBuf wb_;
Buf rb_; ReadBuf rb_;
}; };
} // namespace shrpx } // namespace shrpx