File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
src/Tests/Tests.Benchmarking Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Linq ;
3+ using BenchmarkDotNet . Attributes ;
4+ using Elasticsearch . Net ;
5+ using Nest ;
6+ using Tests . Benchmarking . Framework ;
7+
8+ namespace Tests . Benchmarking
9+ {
10+ [ BenchmarkConfig ]
11+ public class ConnectionMechanicsBenchmarkTests
12+ {
13+ private IElasticClient Client { get ; set ; }
14+ private PostData Post { get ; set ; }
15+
16+ [ GlobalSetup ]
17+ public void Setup ( )
18+ {
19+ Post = PostData . String ( "{}" ) ;
20+
21+ var nodes = Enumerable . Range ( 0 , 100 ) . Select ( i => new Node ( new Uri ( $ "http://localhost:{ i } ") ) ) . ToList ( ) ;
22+
23+ var connectionPool = new SniffingConnectionPool ( nodes ) ;
24+ var connection = new InMemoryConnection ( ) ;
25+ var settings = new ConnectionSettings ( connectionPool , connection )
26+ . SniffOnStartup ( false )
27+ . SniffOnConnectionFault ( false ) ;
28+ Client = new ElasticClient ( settings ) ;
29+
30+ }
31+
32+
33+ [ Benchmark ( Description = "SearchResponse" , OperationsPerInvoke = 1000 ) ]
34+ public void SearchResponse ( )
35+ {
36+ var response = Client . LowLevel . Search < VoidResponse > ( "index" , Post ) ;
37+ }
38+ }
39+ }
You can’t perform that action at this time.
0 commit comments