-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FLUME-603: Revisit Performance tests
- Remove dependencies on non-existing data sets. - Remove reporting tests (not relevent/supported) - Add some accounting to avro sink to present proper MB/s statistitcs on batched datasets - Update Maven build to create "microbenchmarks" profile
- Loading branch information
Jonathan Hsieh
committed
Jun 30, 2011
1 parent
f7f2e10
commit bef14eb
Showing
36 changed files
with
1,208 additions
and
474 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
flume-core/src/main/java/org/apache/avro/ipc/AccountingTransceiver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package org.apache.avro.ipc; | ||
|
||
import java.io.IOException; | ||
import java.nio.ByteBuffer; | ||
import java.util.List; | ||
import java.util.concurrent.atomic.AtomicLong; | ||
|
||
import org.apache.avro.Protocol; | ||
import org.apache.avro.ipc.Transceiver; | ||
|
||
public class AccountingTransceiver extends Transceiver { | ||
Transceiver xcvr; | ||
|
||
AtomicLong bytesWritten = new AtomicLong(); | ||
|
||
public AccountingTransceiver(Transceiver xcvr) { | ||
this.xcvr = xcvr; | ||
} | ||
|
||
@Override | ||
public String getRemoteName() { | ||
return xcvr.getRemoteName(); | ||
} | ||
|
||
// Transceive is explicitly excluded because it calls readBuffers and | ||
// writeBuffers virtual funcs. | ||
|
||
@Override | ||
public List<ByteBuffer> readBuffers() throws IOException { | ||
return xcvr.readBuffers(); | ||
} | ||
|
||
@Override | ||
public void writeBuffers(List<ByteBuffer> arg0) throws IOException { | ||
long len = getLength(arg0); // must be done before writing them. | ||
xcvr.writeBuffers(arg0); | ||
bytesWritten.addAndGet(len); | ||
} | ||
|
||
@Override | ||
public boolean isConnected() { | ||
return xcvr.isConnected(); | ||
} | ||
|
||
@Override | ||
public void setRemote(Protocol protocol) { | ||
xcvr.setRemote(protocol); | ||
} | ||
|
||
@Override | ||
public Protocol getRemote() { | ||
return xcvr.getRemote(); | ||
} | ||
|
||
@Override | ||
public void close() throws IOException { | ||
xcvr.close(); | ||
} | ||
|
||
public long getSentBytes() { | ||
return bytesWritten.get(); | ||
} | ||
|
||
static int getLength(List<ByteBuffer> buffers) { | ||
int length = 0; | ||
for (ByteBuffer buffer : buffers) { | ||
length += 4; | ||
length += buffer.remaining(); | ||
} | ||
length += 4; | ||
return length; | ||
} | ||
|
||
static long bufferLens(List<ByteBuffer> buffers) throws IOException { | ||
long len = getLength(buffers); | ||
return len + 4; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.