Skip to content

Commit c02c042

Browse files
Mike WiederholdMichael Wiederhold
authored andcommitted
SPY-125: Significant performance issue large number of sets
We now add an operation to the read queue when we transistion it into a WRITING state. This guarentees that the operation is added to the read queue once. As a result we no longer have to check to see if the operation has already been added to the read queue Change-Id: I0b21d3e1ac7ff7792afabc57c1a8a26c6b757c12 Reviewed-on: http://review.couchbase.org/9425 Reviewed-by: Michael Wiederhold <[email protected]> Tested-by: Michael Wiederhold <[email protected]>
1 parent e69df0c commit c02c042

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/main/java/net/spy/memcached/protocol/TCPMemcachedNodeImpl.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -171,18 +171,13 @@ public final void fillWriteBuffer(boolean shouldOptimize) {
171171
return;
172172
} else {
173173
o.writing();
174+
if (!(o instanceof TapAckOperationImpl)) {
175+
readQ.add(o);
176+
}
174177
}
175178
}
176179
while(o != null && toWrite < getWbuf().capacity()) {
177180
assert o.getState() == OperationState.WRITING;
178-
// This isn't the most optimal way to do this, but it hints
179-
// at a larger design problem that may need to be taken care
180-
// if in the bowels of the client.
181-
// In practice, readQ should be small, however.
182-
// Also don't add Tap Acks to the readQ since there won't be a response
183-
if(!readQ.contains(o) && !(o instanceof TapAckOperationImpl)) {
184-
readQ.add(o);
185-
}
186181

187182
ByteBuffer obuf=o.getBuffer();
188183
assert obuf != null : "Didn't get a write buffer from " + o;
@@ -205,6 +200,9 @@ public final void fillWriteBuffer(boolean shouldOptimize) {
205200
o=getCurrentWriteOp();
206201
if (o != null) {
207202
o.writing();
203+
if (!(o instanceof TapAckOperationImpl)) {
204+
readQ.add(o);
205+
}
208206
}
209207
}
210208
toWrite += bytesToCopy;

0 commit comments

Comments
 (0)