Skip to content
Browse files

Better cpu burning time.

  • Loading branch information...
1 parent c8d970b commit 2c63b7a29105fc4de9ede9679e1ad2a0610f8e4a @jghoman committed Sep 26, 2011
Showing with 5 additions and 5 deletions.
  1. +3 −3 src/main/java/jghoman/Client.java
  2. +2 −2 src/main/java/jghoman/Server.java
View
6 src/main/java/jghoman/Client.java
@@ -17,7 +17,7 @@ public static void main(String[] args) {
Service<ThriftClientRequest, byte[]> client = ClientBuilder.safeBuild(ClientBuilder.get()
.hosts(new InetSocketAddress(8080))
.codec(new ThriftClientFramedCodecFactory())
- .hostConnectionLimit(25)); // IMPORTANT: this determines how many rpc's are sent in at once.
+ .hostConnectionLimit(100)); // IMPORTANT: this determines how many rpc's are sent in at once.
// If set to 1, you get no parallelism on for this client.
@@ -50,12 +50,12 @@ public void onFailure(Throwable throwable) {
});
// Now let's inundate the server with lots of blocking calls and watch as it handles them
- int numCalls = 100;
+ int numCalls = 1000;
List<BlockingCallResponse> responses = new ArrayList<BlockingCallResponse>(numCalls);
for (int i = 0; i < numCalls; i++) {
BlockingCallResponse blockingCallResponse = new BlockingCallResponse(i);
- // Send call to the server, return it's result handler
+ // Send call to the server, return its result handler
haverClient.blocking_call().addEventListener(blockingCallResponse);
responses.add(blockingCallResponse);
System.out.println("Queued up request #" + i);
View
4 src/main/java/jghoman/Server.java
@@ -33,8 +33,8 @@ public Integer apply() {
long acc = 0;
while(System.currentTimeMillis() < delayUntil) {
// Let's bind and gag the CPU
- for(int i = 0; i < 1000000; i++) {
- for(int j = 0; j < 100000; j++) {
+ for(int i = 0; i < 1000; i++) {
+ for(int j = 0; j < 1000; j++) {
acc += delayForSeconds + j + i;
}
}

0 comments on commit 2c63b7a

Please sign in to comment.
Something went wrong with that request. Please try again.