directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r415083 - in /directory/sandbox/akarasulu/mina-profiling: README.txt client/src/main/java/org/apache/mina/performance/test/client/TestClient.java server/server.sh server/src/main/java/org/apache/mina/performance/test/server/TestServer.java
Date Sun, 18 Jun 2006 01:55:57 GMT
Author: akarasulu
Date: Sat Jun 17 18:55:55 2006
New Revision: 415083

URL: http://svn.apache.org/viewvc?rev=415083&view=rev
Log:
updating shell script for server to add port parameter and shift arguments, also
letting client take hostname port and number of searches to perform.

Added:
    directory/sandbox/akarasulu/mina-profiling/README.txt
Modified:
    directory/sandbox/akarasulu/mina-profiling/client/src/main/java/org/apache/mina/performance/test/client/TestClient.java
    directory/sandbox/akarasulu/mina-profiling/server/server.sh
    directory/sandbox/akarasulu/mina-profiling/server/src/main/java/org/apache/mina/performance/test/server/TestServer.java

Added: directory/sandbox/akarasulu/mina-profiling/README.txt
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/mina-profiling/README.txt?rev=415083&view=auto
==============================================================================
--- directory/sandbox/akarasulu/mina-profiling/README.txt (added)
+++ directory/sandbox/akarasulu/mina-profiling/README.txt Sat Jun 17 18:55:55 2006
@@ -0,0 +1,46 @@
+The following project is for profiling MINA using a very simple client and 
+server.  It has two module: client and server.  
+
+The client is a hardcoded LDAP client.  It sends ethereal captured LDAP PDUs to
+any LDAP server to read the RootDSE.  It first sends a bind PDU with a bind 
+principal of 'uid=admin,ou=system' and password of 'secret'.  The bind is a 
+simple bind as you see.  Again the PDU is a captured byte array so there's
+really nothing LDAP specific in the code.  After the bind the client sends one
+or more search requests.  The number of requests are specified as a parameter
+to the client application.  Finally after searching the RootDSE N number of 
+times the client sends an Unbind request to the server.   All requests are 
+precaptured byte[]s of PDUs.  To build and run the client issue the following 
+command:
+
+       ./client/client.sh <hostname> <port> <n>
+
+Where <n> is the number of search requests to send to the server.
+
+The server likewise sends pre-constructed captured PDU byte[]s back to the 
+client.  For the bind request it checks the request type and returns a bind 
+response of success.  For the search request it returns a byte[] containing the
+RootDSE entry and then sends a search done PDU in another byte[].  The server
+reports to the command line every second the number of requests per second it 
+has processed.  Building and running the server is simple:
+
+       ./server/server.sh 
+
+If you want to profile the server using yourkit you'll want to setup your 
+LD_LIBRARY_PATH to point to the area where the shared libraries for yourkit are
+stored for your platform.  For example my setup is as follows:
+
+export LD_LIBRARY_PATH=/opt/tools/yjp-5.1/bin/linux-x86-32
+
+Now to run the server then attach the profiler to it start the server like so:
+
+       ./server/server.sh profile
+
+To override the default listener port which is 10389 just add another port
+value after the profile keyword like so:
+
+       ./server/server.sh profile 1024
+
+If you're not profiling but want to override the port just add the port number:
+
+       ./server/server.sh 1024
+

Modified: directory/sandbox/akarasulu/mina-profiling/client/src/main/java/org/apache/mina/performance/test/client/TestClient.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/mina-profiling/client/src/main/java/org/apache/mina/performance/test/client/TestClient.java?rev=415083&r1=415082&r2=415083&view=diff
==============================================================================
--- directory/sandbox/akarasulu/mina-profiling/client/src/main/java/org/apache/mina/performance/test/client/TestClient.java
(original)
+++ directory/sandbox/akarasulu/mina-profiling/client/src/main/java/org/apache/mina/performance/test/client/TestClient.java
Sat Jun 17 18:55:55 2006
@@ -15,12 +15,15 @@
 {
     public static void main( String[] args ) throws Exception
     {
-        if( args.length == 0 )
+        if( args.length < 3 )
         {
-            System.out.println( "Please specify the number of searches to perform." );
+            System.out.println( "Usage: client.sh <hostname> <port> <requestCount>"
);
             return;
         }
 
+        String hostname = args[0];
+        int port = Integer.parseInt( args[1] );
+        int requestCount = Integer.parseInt( args[2] );
         IoConnector connector = new SocketConnector( 2 );
         ( ( IoConnectorConfig ) connector.getDefaultConfig() ).setConnectTimeout( 10 );
         
@@ -29,8 +32,8 @@
         {
             try
             {
-                ConnectFuture future = connector.connect( 
-                    new InetSocketAddress( "newton", 10389 ), new TestClientHandler( Integer.parseInt(
args[0] ) ) );
+                InetSocketAddress addr = new InetSocketAddress( hostname, port );
+                ConnectFuture future = connector.connect( addr, new TestClientHandler( requestCount
) );
                 
                 future.join();
                 session = future.getSession();
@@ -44,7 +47,6 @@
             }
         }
 
-        // wait until the summation is done
         session.getCloseFuture().join();
     }
 }

Modified: directory/sandbox/akarasulu/mina-profiling/server/server.sh
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/mina-profiling/server/server.sh?rev=415083&r1=415082&r2=415083&view=diff
==============================================================================
--- directory/sandbox/akarasulu/mina-profiling/server/server.sh (original)
+++ directory/sandbox/akarasulu/mina-profiling/server/server.sh Sat Jun 17 18:55:55 2006
@@ -7,6 +7,8 @@
 fi
 
 if [ $1 == "profile" ]; then
+  shift 1;
+  echo $@
   java -agentlib:yjpagent -Dlog4j.configuration=file://$(pwd)/log4j.properties -jar target/server-1.0-SNAPSHOT-app.jar
$@
 else
   java -Dlog4j.configuration=file://$(pwd)/log4j.properties -jar target/server-1.0-SNAPSHOT-app.jar
$@

Modified: directory/sandbox/akarasulu/mina-profiling/server/src/main/java/org/apache/mina/performance/test/server/TestServer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/mina-profiling/server/src/main/java/org/apache/mina/performance/test/server/TestServer.java?rev=415083&r1=415082&r2=415083&view=diff
==============================================================================
--- directory/sandbox/akarasulu/mina-profiling/server/src/main/java/org/apache/mina/performance/test/server/TestServer.java
(original)
+++ directory/sandbox/akarasulu/mina-profiling/server/src/main/java/org/apache/mina/performance/test/server/TestServer.java
Sat Jun 17 18:55:55 2006
@@ -18,6 +18,11 @@
         if ( args.length > 0 )
         {
             port = Integer.parseInt( args[0] );
+            System.out.println( "Overriding bind port to " + port );
+        }
+        else
+        {
+            System.out.println( "Using default bind port " + port );
         }
 
         IoAcceptor acceptor = new SocketAcceptor( 2 );



Mime
View raw message