Problem running trivial spray-can app

191 views
Skip to first unread message

Adam Evans

unread,
Aug 4, 2012, 9:32:59 AM8/4/12
to spray...@googlegroups.com
Hello,

I'm just experimenting with Spray, Akka and Scala trying to learn/evaluate them. I've built a trivial project based on the examples but I have trouble running it.

When I start the project it exits after registering a cc.spray.HttpService actor, no error messages or additional log messages indicating why it's exited. On exit it reports a error code 255 when doing "echo $?" .

I've spent so time trying to debug but am at a loss, the build is near enough the same as https://github.com/spray/spray/blob/master/examples/spray-server/simple-on-spray-can .

I've put the experimental project up at https://github.com/ajevans85/akka-benchmark . If anyone can offer some pointers on where I'm going wrong or how to further debug that would be fantastic. From the logging I've enabled this is all I get before it exits:

[DEBUG] [08/04/2012 14:22:15.222] [main] [EventStream(akka://App)] logger log1-Logging$DefaultLogger started
[DEBUG] [08/04/2012 14:22:15.224] [main] [EventStream(akka://App)] Default Loggers started
[DEBUG] [08/04/2012 14:22:15.224] [main] [EventStream] unsubscribing StandardOutLogger from all channels
[DEBUG] [08/04/2012 14:22:15.302] [App-akka.actor.default-dispatcher-2] [akka://App/user] now supervising Actor[akka://App/user/http-service]
[DEBUG] [08/04/2012 14:22:15.303] [App-akka.actor.default-dispatcher-3] [akka://App/user] now supervising Actor[akka://App/user/root-service]
[DEBUG] [08/04/2012 14:22:15.318] [App-akka.actor.default-dispatcher-1] [akka://App/user/http-service] Starting HTTP Service ...
[DEBUG] [08/04/2012 14:22:15.319] [App-akka.actor.default-dispatcher-1] [akka://App/user/http-service] started (cc.spray.HttpService@7e9b4e6c)

 

Chris Carrier

unread,
Aug 6, 2012, 12:51:42 PM8/6/12
to spray...@googlegroups.com
Any reason you've converted it to maven? I've never used Maven with
Scala so not sure how much help I can be. It should work Ok but you
may find it frustrating to find examples for certain problems since
SBT is by far the more popular build system for Scala.

That said when I pulled your project and tried to build I got this error:

java.lang.ExceptionInInitializerError
at cc.spray.RootService.<init>(RootService.scala:36)
at cc.spray.SprayCanRootService.<init>(SprayCanRootService.scala:32)
at org.aevans.akka.benchmark.BenchmarkApp$$anonfun$4.apply(BenchmarkApp.scala:30)
at org.aevans.akka.benchmark.BenchmarkApp$$anonfun$4.apply(BenchmarkApp.scala:30)
at akka.actor.ActorCell.newActor(ActorCell.scala:488)
at akka.actor.ActorCell.create$1(ActorCell.scala:506)
at akka.actor.ActorCell.systemInvoke(ActorCell.scala:593)
at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:208)
at akka.dispatch.Mailbox.run(Mailbox.scala:177)
at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:505)
at akka.jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:259)
at akka.jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:974)
at akka.jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1478)
at akka.jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104)
Caused by: com.typesafe.config.ConfigException$Missing: No
configuration setting found for key 'spray.servlet'
at com.typesafe.config.impl.SimpleConfig.findKey(SimpleConfig.java:115)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:135)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:140)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:108)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:146)
at com.typesafe.config.impl.SimpleConfig.getObject(SimpleConfig.java:200)
at com.typesafe.config.impl.SimpleConfig.getConfig(SimpleConfig.java:207)
at com.typesafe.config.impl.SimpleConfig.getConfig(SimpleConfig.java:32)
at cc.spray.SprayServletSettings$.<init>(SprayServletSettings.scala:27)
at cc.spray.SprayServletSettings$.<clinit>(SprayServletSettings.scala)

Chris Carrier

unread,
Aug 6, 2012, 1:07:09 PM8/6/12
to spray...@googlegroups.com
I'm not really familiar with that example so I'm not sure if it's
completely up to date. You may want to give the Spray template
project a try as I know it works with all the new stuff:

https://github.com/spray/spray-template/tree/spray-can-1.0-M1

The problem may be with the way you are packaging the project. The
way Akka 2 does configurations is to provide a reference.conf file
with the necessary settings for each project/library. The problem is
that normal packaging tools get confused when you try to make an uber
JAR because all these files have the same name. You need to make sure
all these files are properly combined into one uber reference.conf so
nothing is lost. Last time I used Maven there was something called
shade plugin that did something similar with my Spring config files.
In SBT there's a setting for the assembly plugin that with do it.

Not positive this is the problem but worth a look.

Chris

Adam Evans

unread,
Aug 6, 2012, 4:05:34 PM8/6/12
to spray...@googlegroups.com
Thanks for the pointers.

I've used maven as I've been playing with this great example which also uses maven https://github.com/janm399/akka-patterns , also I've constraints at work where we are currently tied maven for our CI so if can get it working using maven that's one thing less off the list pushing spray for certain services.

I tracked down the issue, it was <index>true</index> on the maven-jar archiver plugin. This generates a archive with INDEX.LIST, not quite sure what that means but it was the issue.

Using siege I've managed to get 1700 requests/sec on a 2ghz i7 macbook pro with 16Gb ram.

[adam@Adams-MacBook-Pro ~]$ siege -c 100 -t 10s -b http://localhost:8080/
** SIEGE 2.72
** Preparing 100 concurrent users for battle.
The server is now under siege...
Lifting the server siege...      done.

Transactions:       16462 hits
Availability:      100.00 %
Elapsed time:        9.64 secs
Data transferred:        0.17 MB
Response time:        0.05 secs
Transaction rate:     1707.68 trans/sec
Throughput:        0.02 MB/sec
Concurrency:       79.66
Successful transactions:       16462
Failed transactions:           0
Longest transaction:        0.33
Shortest transaction:        0.01


If I up the time of the benchmark from 10 seconds to 30 seconds I start seeing socket timeouts and the transaction rate drops to around 550 reqs/sec with 16642 succefull transactions and 200 failed.

[error] socket: unable to connect sock.c:222: Operation timed out

I'm not sure if this timeout will be a OS issue with benchmarking on my local machine and resources running out or is Spray failing to handle the requests in time and dropping them on timeout of the actor?
Reply all
Reply to author
Forward
0 new messages