package com.ociweb.gl.example.parallel;

import org.junit.Test;

import com.ociweb.gl.api.GreenRuntime;
import com.ociweb.gl.test.ParallelClientLoadTester;
import com.ociweb.gl.test.ParallelClientLoadTesterConfig;
import com.ociweb.gl.test.ParallelClientLoadTesterPayload;

public class NamedMessagePassingTest {

	@Test
	public void runTest() {

		//order supervisor blocks because it must have 1 incoming pipe for each
		//of the N unit pipes coming in or data can be hidden !!!
		
		//need more threads for volume??
		
		boolean telemetry = true;
		
		GreenRuntime.run(new NamedMessagePassingApp(telemetry));
		
		ParallelClientLoadTesterPayload payload 
				= new ParallelClientLoadTesterPayload("{\"key1\":\"value\",\"key2\":123}");
		
		ParallelClientLoadTesterConfig config1 = 
				new ParallelClientLoadTesterConfig(2, 50000, 8080, "/test", false);
		GreenRuntime.testConcurrentUntilShutdownRequested(
				new ParallelClientLoadTester(config1, null),
				600_000);

		ParallelClientLoadTesterConfig config2 = 
				new ParallelClientLoadTesterConfig(1, 100_000, 8080, "/test", telemetry);
		
		config2.simultaneousRequestsPerTrackBits  = 1;
		config2.responseTimeoutNS = 0L;
		
		//config2.rate = 4_000L;
		
		//For low latency
		config2.rate = 1_000L; //TODO: may need to be bigger for slow windows boxes.
				
		//TODO: ensure we have enought volume to make the optimization...
		
		GreenRuntime.testConcurrentUntilShutdownRequested(
				new ParallelClientLoadTester(config2, null),
				2_000_000);
	}
}

@@ -310,213 +310,231 @@
 t %7B%0A
-%0A%09@Test%0A%09public void runTest() %7B%0A%0A%09%09//order supervisor blocks because it must have 1 incoming pipe for each
+%09///////////-XX:+UseLargePages %0A%09//          -verbose:gc -Xloggc:gc.log -XX:+PrintGCTimeStamps -XX:+PrintGCDetails
 %0A%09
+%0A
 %09//
-of the N unit pipes coming in or data can be hidden !!!%0A%09%09%0A%09%09//need more threads for volume??
+ -XX:MaxGCPauseMillis=5 -XX:+UseG1GC%0A%09// -XX:MaxDirectMemorySize=256m%0A%0A%09@Test%0A%09public void runTest() %7B%0A
 %0A%09%09%0A
@@ -561,16 +561,36 @@
 = true;%0A
+%09%09long rate = 2000;%0A
 %09%09%0A%09%09Gre
@@ -639,16 +639,21 @@
 elemetry
+,rate
 ));%0A%09%09%0A%09
@@ -893,16 +893,91 @@
 false);%0A
+%09%09config1.rate = rate;%0A%09%09config1.simultaneousRequestsPerTrackBits  = 4;%0A%09%09%0A
 %09%09GreenR
@@ -1168,17 +1168,17 @@
 rConfig(
-1
+2
 , 100_00
@@ -1256,17 +1256,17 @@
 Bits  = 
-1
+4
 ;%0A%09%09conf
@@ -1298,39 +1298,8 @@
 L;%0A%09
-%09%0A%09%09//config2.rate = 4_000L;%0A%09%09
 %0A%09%09/
@@ -1336,14 +1336,12 @@
 e = 
-1_000L
+rate
 ; //
@@ -1428,17 +1428,16 @@
 e enough
-t
  volume 

test update