I'm building a RESTful API using Akka and Spray. I'm using the Typesafe Akka Cluster Sample project...
(http://www.typesafe.com/activator/template/akka-sample-cluster-scala) as a reference. I have a cluster which uses a pool of routees and cluster aware routing. The interface to the API is through a spray frontend which creates an actor (ClusterClient) that acts as a frontend to the cluster and monitors cluster activity (new nodes, downed nodes etc...). When a request comes in to a spray route I delegate the work to a Cluster backend worker via the cluster aware router. My hope/goal here is that I can increase performance in the system by adding more back-end worker nodes and routees as needed. I may also add more frontend (spray) nodes that will be accessed via a Load Balancer. I'm trying to build something performant and scalable. This all works fine. The worker actors at the moment just return a string for testing. Before I go any further I wanted to get an idea of current cluster performance by stress testing the application. So I am using apache bench to do some quick tests. All the testing is being done on my local development machine (QuadCore Macbook Pro with 16gb RAM). The application is running on spray-can. The frontend (spray) and backend nodes are being kicked off on seperate JVM's on the same machine by using different ports. The strange thing is performance seems to degrade when I add more backend nodes to the cluster. Here are my tests and results. I ran each test about 10 times to get better average... One Backend Node ab -l -n 1000 -c 100 http://localhost:3050/api Requests per second [#/sec] (mean): 4708.25, 5086.11, 4341.52, 5850.76, 4403.33, 5046.78, 4151.84, 5686.24, 3399.38, 4466.26, 3755.98, 5619.18, 5187.96 Average: 4745 requests per second Two Backend Nodes ab -l -n 1000 -c 100 http://localhost:3050/api Requests per second [#/sec] (mean): 3381.75, 4108.51, 2969.41, 3732.29, 3804.48, 3644.12, 2516.05, 2968.17, 3308.01, 3378.69, 4049.71, 3738.21, 4068.84 Average: 3512 requests per second Three Backend Nodes ab -l -n 1000 -c 100 http://localhost:3050/api Requests per second [#/sec] (mean): 2756.49, 2516.77, 2535.34, 2464.37, 2887.51, 2421.98, 2794.03, 2633.36, 2735.74, 3021.81, 2612.39, 3052.53, 3714.88 Average: 2780 requests per second Is this expected? i.e. Am I wrong in thinking that I should be getting more performance by adding more backend/worker nodes? Based on the figures above, the more nodes I add to the cluster the worse the performance will become. I also ran the same tests on AWS using a couple of t2.small instances. On both instances I deployed my application and kicked off two "backend" cluster nodes. I then started my frontend spray node on one of the instances and used apache bench to test the cluster. Again I get about 30% less performance from the cluster when I have two backend nodes compared to one. So the problem does not seem to be related to running the test on a single development machine. Has anyone any ideas? Am I using Akka's clustering capabilities incorrectly? Thanks -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
