Skip to content

Commit

Permalink
Merge pull request #17 from Tenzo/feature/performance-tools
Browse files Browse the repository at this point in the history
Feature/performance tools
  • Loading branch information
tenzo committed Sep 21, 2015
2 parents fab2d73 + 0c4bbb5 commit 9db9a59
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 1 deletion.
16 changes: 16 additions & 0 deletions jetty/jetty-config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Configure id="Server" class="org.eclipse.jetty.server.Server">

<!-- =========================================================== -->
<!-- Configure the Server Thread Pool. -->
<!-- -->
<!-- Consult the javadoc of o.e.j.util.thread.QueuedThreadPool -->
<!-- for all configuration that may be set here. -->
<!-- =========================================================== -->
<Get name="ThreadPool">
<Set name="minThreads" type="int">10</Set>
<Set name="maxThreads" type="int">200</Set>
<Set name="idleTimeout" type="int">60000</Set>
<Set name="detailedDump">false</Set>
</Get>
</Configure>

Binary file added jetty/jetty9.3.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion jetty/runserver.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
java -jar jetty-runner-9.1.0.M0.jar --port 8081 ../build/libs/restBalancer-0.1.war
java -jar jetty9.3.jar --port 8081 --config jetty-config.xml ../build/libs/restBalancer-0.1.war
7 changes: 7 additions & 0 deletions performance/HOWTO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
To run performance test install locoust:

# pip install locustio

and run (in directory containing locustfile.py):

# locust --host=http://hostname:port
13 changes: 13 additions & 0 deletions performance/locustfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from locust import HttpLocust, TaskSet, task

class GetGroup(TaskSet):

@task
def group(self):
for i in range(1000000):
self.client.get("/group?userId=user%i" % i, name="/group?userId=[userId]")

class WebsiteUser(HttpLocust):
task_set = GetGroup
min_wait=5000
max_wait=9000
Binary file added performance/locustfile.pyc
Binary file not shown.
3 changes: 3 additions & 0 deletions src/main/java/com/balancer/endpoint/UserGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@

@Path("/")
public class UserGroup {

private static GroupManager groupManager = new GroupManager();

@GET
@Path("/group")
@Produces(MediaType.TEXT_PLAIN)
public Response getTestGroup(@QueryParam("userId") String userId) throws UserIdValidationException {
return groupManager.getGroup(userId);
}

@GET
@Path("/all")
@Produces(MediaType.TEXT_PLAIN)
Expand Down

0 comments on commit 9db9a59

Please sign in to comment.