Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(475)

Unified Diff: net/tools/flip_server/flip_in_mem_edsm_server.cc

Issue 5966003: Reduce the Spdy data frame sizes used. Attempt to make them fit within SSL... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/flip_server/flip_in_mem_edsm_server.cc
===================================================================
--- net/tools/flip_server/flip_in_mem_edsm_server.cc (revision 69432)
+++ net/tools/flip_server/flip_in_mem_edsm_server.cc (working copy)
@@ -270,9 +270,12 @@
////////////////////////////////////////////////////////////////////////////////
-const int kMSS = 1460;
-const int kInitialDataSendersThreshold = (2 * kMSS) - SpdyFrame::size();
-const int kNormalSegmentSize = (2 * kMSS) - SpdyFrame::size();
+const int kMSS = 1400; // Linux default
+const int kSSLOverhead = 33;
+const int kSpdyOverhead = SpdyFrame::size();
+const int kInitialDataSendersThreshold = (2 * kMSS) - kSpdyOverhead;
+const int kSSLSegmentSize = (1 * kMSS) - kSSLOverhead;
+const int kSpdySegmentSize = kSSLSegmentSize - kSpdyOverhead;
////////////////////////////////////////////////////////////////////////////////
@@ -1555,7 +1558,7 @@
first_ring.splice(first_ring.end(),
first_ring,
first_ring.begin());
- mci.max_segment_size = kNormalSegmentSize;
+ mci.max_segment_size = kSpdySegmentSize;
return &mci;
}
return NULL;
@@ -2071,16 +2074,44 @@
// TODO(mbelshe): We can't compress here - before going into the
// priority queue. Compression needs to be done
// with late binding.
- SpdyDataFrame* fdf = spdy_framer_->CreateDataFrame(stream_id, data, len,
- flags);
- DataFrame df;
- df.size = fdf->length() + SpdyFrame::size();
- df.data = fdf->data();
- df.delete_when_done = true;
- EnqueueDataFrame(df);
- VLOG(2) << ACCEPTOR_CLIENT_IDENT << "SpdySM: Sending data frame "
- << stream_id << " [" << len << "] shrunk to " << fdf->length();
+ if (len == 0) {
+ SpdyDataFrame* fdf = spdy_framer_->CreateDataFrame(stream_id, data, len,
+ flags);
+ DataFrame df;
+ df.size = fdf->length() + SpdyFrame::size();
+ df.data = fdf->data();
+ df.delete_when_done = true;
+ EnqueueDataFrame(df);
+ return;
+ }
+
+ // Chop data frames into chunks so that one stream can't monopolize the
+ // output channel.
+ while(len > 0) {
+ int64 size = std::min(len, static_cast<int64>(kSpdySegmentSize));
+ SpdyDataFlags chunk_flags = flags;
+
+ // If we chunked this block, and the FIN flag was set, there is more
+ // data coming. So, remove the flag.
+ if ((size < len) && (flags & DATA_FLAG_FIN))
+ chunk_flags = static_cast<SpdyDataFlags>(chunk_flags & ~DATA_FLAG_FIN);
+
+ SpdyDataFrame* fdf = spdy_framer_->CreateDataFrame(stream_id, data, size,
+ chunk_flags);
+ DataFrame df;
+ df.size = fdf->length() + SpdyFrame::size();
+ df.data = fdf->data();
+ df.delete_when_done = true;
+ EnqueueDataFrame(df);
+
+ VLOG(2) << ACCEPTOR_CLIENT_IDENT << "SpdySM: Sending data frame "
+ << stream_id << " [" << size << "] shrunk to " << fdf->length()
+ << ", flags=" << flags;
+
+ data += size;
+ len -= size;
+ }
}
void EnqueueDataFrame(const DataFrame& df) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698