22using System . Diagnostics ;
33using System . Threading ;
44using System . Threading . Tasks ;
5+ using System . Linq ;
56using Nest ;
67
78namespace ProtocolLoadTest
@@ -21,10 +22,12 @@ class Program
2122 static void Main ( string [ ] args )
2223 {
2324 double httpRate = RunTest < HttpTester > ( HTTP_PORT ) ;
25+ double manualAsyncHttpRate = RunTest < HttpManualAsyncTester > ( HTTP_PORT ) ;
2426 //double thriftRate = RunTest<ThriftTester>(THRIFT_PORT);
2527
2628 Console . WriteLine ( ) ;
27- Console . WriteLine ( "HTTP: {0:0,0}/s" , httpRate ) ;
29+ Console . WriteLine ( "HTTP (IndexManyAsync): {0:0,0}/s" , httpRate ) ;
30+ Console . WriteLine ( "HTTP (IndexMany + TaskFactory.StartNew): {0:0,0}/s" , manualAsyncHttpRate ) ;
2831 //Console.WriteLine("Thrift: {0:0,0}/s", thriftRate);
2932
3033 Console . ReadLine ( ) ;
@@ -58,9 +61,12 @@ private static double RunTest<T>(int port) where T : ITester
5861
5962 private static void RecreateIndex ( string suffix )
6063 {
64+ var host = "localhost" ;
65+ if ( Process . GetProcessesByName ( "fiddler" ) . Any ( ) )
66+ host = "ipv4.fiddler" ;
6167 string indexName = INDEX_PREFIX + suffix ;
6268
63- var connSettings = new ConnectionSettings ( new Uri ( "http://ipv4.fiddler :9200" ) )
69+ var connSettings = new ConnectionSettings ( new Uri ( "http://" + host + " :9200") )
6470 . SetDefaultIndex ( indexName ) ;
6571
6672 var client = new ElasticClient ( connSettings ) ;
@@ -80,7 +86,7 @@ private static void RecreateIndex(string suffix)
8086 var indexSettings = new IndexSettings ( ) ;
8187 indexSettings . NumberOfReplicas = 1 ;
8288 indexSettings . NumberOfShards = 5 ;
83- indexSettings . Add ( "index.refresh_interval" , "10s " ) ;
89+ indexSettings . Add ( "index.refresh_interval" , "-1 " ) ;
8490
8591 var createResponse = client . CreateIndex ( indexName , indexSettings ) ;
8692 client . MapFromAttributes < Message > ( ) ;
@@ -90,7 +96,11 @@ private static void CloseIndex(string suffix)
9096 {
9197 string indexName = INDEX_PREFIX + suffix ;
9298
93- var connSettings = new ConnectionSettings ( new Uri ( "http://ipv4.fiddler:9200" ) )
99+ var host = "localhost" ;
100+ if ( Process . GetProcessesByName ( "fiddler" ) . Any ( ) )
101+ host = "ipv4.fiddler" ;
102+
103+ var connSettings = new ConnectionSettings ( new Uri ( "http://" + host + ":9200" ) )
94104 . SetDefaultIndex ( indexName ) ;
95105
96106 var client = new ElasticClient ( connSettings ) ;
0 commit comments