<commit_before>package com.ociweb.gl.benchmark;

import java.util.concurrent.atomic.AtomicBoolean;

import com.ociweb.gl.api.GreenApp;
import com.ociweb.gl.api.GreenCommandChannel;
/**
 * ************************************************************************
 * For greenlightning support, training or feature reqeusts please contact:
 *   <EMAIL>   (314) 579-0066
 * ************************************************************************
 */
import com.ociweb.gl.api.GreenFramework;
import com.ociweb.gl.api.GreenRuntime;
import com.ociweb.pronghorn.network.ServerSocketWriterStage;

import io.reactiverse.pgclient.PgClient;
import io.reactiverse.pgclient.PgPoolOptions;

public class FrameworkTest implements GreenApp {

	static final String payloadText="Hello, World!";
	static final byte[] payload = payloadText.getBytes();

	private int bindPort;
    private String host;
    private int concurrentWritesPerChannel;
    private int queueLengthOfPendingRequests;
    private int telemetryPort;//for monitoring
    private int minMemoryOfInputPipes;
    private int dbCallMaxResponseSize;
	private	final int dbCallMaxResponseCount;
    private int pipelineBits;
    
    private final int jsonMaxResponseCount;
    private final int jsonMaxResponseSize;
    
    private PgPoolOptions options;
    
    
    private int maxQueueOut;
    private int maxConnectionBits;
    private int maxRequestSize;
    
    private int connectionsPerTrack;
    private int connectionPort;
	
	
	public AtomicBoolean foundDB = new AtomicBoolean(false);
	public static String connectionHost =     "localhost";
	public static String connectionDB =       "testdb";
	public static String connectionUser =     "postgres";
	public static String connectionPassword = "<PASSWORD>";
			    
    public FrameworkTest() {
    	// use this in commit messages to narrow travis testing to just this project
    	// rebase before using this:  [ci fw-only Java/greenlightning]
    	
    	//this server works best with  -XX:+UseNUMA    	
    	this(System.getProperty("host","0.0.0.0"), 
    		 8080,    	//default port for test 
    		 7,       	//default concurrency per track
    		 2*(1<<14), //request queue length 
    		 1<<22,     //default total size of network buffer used by blocks
    		 Integer.parseInt(System.getProperty("telemetry.port", "-1")),
    		 "tfb-database", // jdbc:postgresql://tfb-database:5432/hello_world
    		 "hello_world",
    		 "benchmarkdbuser",
    		 "benchmarkdbpass"
    		 );    	
    }   
        
    public FrameworkTest(String host, int port, 
    		             int concurrentWritesPerChannel, 
    		             int queueLengthOfPendingRequests, 
    		             int minMemoryOfInputPipes,
    		             int telemetryPort,
    		             String dbHost,
    		             String dbName,
    		             String dbUser,
    		             String dbPass) {
    	
    	this.connectionsPerTrack = 2;
    	this.connectionPort = 5432;
    	this.bindPort = port;
    	this.host = host;
    	this.concurrentWritesPerChannel = concurrentWritesPerChannel;
    	this.queueLengthOfPendingRequests = queueLengthOfPendingRequests;
    	this.minMemoryOfInputPipes = minMemoryOfInputPipes;
    	this.telemetryPort = telemetryPort;
    	this.pipelineBits = 14;//max concurrent in flight database requests 1<<pipelineBits
    	
    	this.dbCallMaxResponseCount = 1<<9;
    	this.jsonMaxResponseCount = 3*(1<<14);
    	
    	this.dbCallMaxResponseSize = 20_000; //for 500 mult db call in JSON format
    	this.jsonMaxResponseSize = 1<<8;

    	this.maxQueueOut = 64;
    	this.maxConnectionBits = 13;
    	this.maxRequestSize = 1<<9;
    	    	
    	if (!"127.0.0.1".equals(System.getProperty("host",null))) { 
    		    		
	    	if (null!=dbHost) {
	    		this.connectionHost = dbHost;
	    	}
	    	if (null!=dbName) {
	    		this.connectionDB = dbName;
	    	}
	    	if (null!=dbUser) {
	    		this.connectionUser = dbUser;
	    	}
	    	if (null!=dbPass) {<commit_msg>GL, Minimize max connections to reduce memory usage (#4355)<commit_after>package com.ociweb.gl.benchmark;

import java.util.concurrent.atomic.AtomicBoolean;

import com.ociweb.gl.api.GreenApp;
import com.ociweb.gl.api.GreenCommandChannel;
/**
 * ************************************************************************
 * For greenlightning support, training or feature reqeusts please contact:
 *   <EMAIL>   (314) 579-0066
 * ************************************************************************
 */
import com.ociweb.gl.api.GreenFramework;
import com.ociweb.gl.api.GreenRuntime;
import com.ociweb.pronghorn.network.ServerSocketWriterStage;

import io.reactiverse.pgclient.PgClient;
import io.reactiverse.pgclient.PgPoolOptions;

public class FrameworkTest implements GreenApp {

	static final String payloadText="Hello, World!";
	static final byte[] payload = payloadText.getBytes();

	private int bindPort;
    private String host;
    private int concurrentWritesPerChannel;
    private int queueLengthOfPendingRequests;
    private int telemetryPort;//for monitoring
    private int minMemoryOfInputPipes;
    private int dbCallMaxResponseSize;
	private	final int dbCallMaxResponseCount;
    private int pipelineBits;
    
    private final int jsonMaxResponseCount;
    private final int jsonMaxResponseSize;
    
    private PgPoolOptions options;
    
    
    private int maxQueueOut;
    private int maxConnectionBits;
    private int maxRequestSize;
    
    private int connectionsPerTrack;
    private int connectionPort;
	
	
	public AtomicBoolean foundDB = new AtomicBoolean(false);
	public static String connectionHost =     "localhost";
	public static String connectionDB =       "testdb";
	public static String connectionUser =     "postgres";
	public static String connectionPassword = "<PASSWORD>";
			    
    public FrameworkTest() {
    	// use this in commit messages to narrow travis testing to just this project
    	// rebase before using this:  [ci fw-only Java/greenlightning]
    	
    	//this server works best with  -XX:+UseNUMA    	
    	this(System.getProperty("host","0.0.0.0"), 
    		 8080,    	//default port for test 
    		 13,       	//default concurrency per track
    		 2*(1<<14), //request queue length 
    		 1<<22,     //default total size of network buffer used by blocks
    		 Integer.parseInt(System.getProperty("telemetry.port", "-1")),
    		 "tfb-database", // jdbc:postgresql://tfb-database:5432/hello_world
    		 "hello_world",
    		 "benchmarkdbuser",
    		 "benchmarkdbpass"
    		 );    	
    }   
        
    public FrameworkTest(String host, int port, 
    		             int concurrentWritesPerChannel, 
    		             int queueLengthOfPendingRequests, 
    		             int minMemoryOfInputPipes,
    		             int telemetryPort,
    		             String dbHost,
    		             String dbName,
    		             String dbUser,
    		             String dbPass) {
    	
    	this.connectionsPerTrack = 2;
    	this.connectionPort = 5432;
    	this.bindPort = port;
    	this.host = host;
    	this.concurrentWritesPerChannel = concurrentWritesPerChannel;
    	this.queueLengthOfPendingRequests = queueLengthOfPendingRequests;
    	this.minMemoryOfInputPipes = minMemoryOfInputPipes;
    	this.telemetryPort = telemetryPort;
    	this.pipelineBits = 14;//max concurrent in flight database requests 1<<pipelineBits
    	
    	this.dbCallMaxResponseCount = 1<<9;
    	this.jsonMaxResponseCount = 3*(1<<14);
    	
    	this.dbCallMaxResponseSize = 20_000; //for 500 mult db call in JSON format
    	this.jsonMaxResponseSize = 1<<8;

    	this.maxQueueOut = 64;
    	this.maxConnectionBits = 9;
    	this.maxRequestSize = 1<<9;
    	    	
    	if (!"127.0.0.1".equals(System.getProperty("host",null))) { 
    		    		
	    	if (null!=dbHost) {
	    		this.connectionHost = dbHost;
	    	}
	    	if (null!=dbName) {
	    		this.connectionDB = dbName;
	    	}
	    	if (null!=dbUser) {
	    		this.connectionUser = dbUser;
	    	}
	    	if (null!=dbPass) {
{'fraction_non_alphanumeric': 0.11864406779661017, 'fraction_numerical': 0.017198404785643072, 'mean_word_length': 2.8159771754636234, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '380635', 'n_tokens_mistral': 2508, 'n_tokens_neox': 2320, 'n_words': 544}