Skip to content

Commit c7c18d1

Browse files
author
Alex Schneider
committed
2 parents 0231fd1 + e764dea commit c7c18d1

File tree

14 files changed

+236
-0
lines changed

14 files changed

+236
-0
lines changed

scruffy/.gitignore

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
## generic files to ignore
2+
*~
3+
*.lock
4+
*.DS_Store
5+
*.swp
6+
*.out
7+
8+
# java specific
9+
*.class
10+
11+
# python specific
12+
*.pyc
13+
14+
# sbt specific
15+
target/
16+
project/boot
17+
lib_managed/*
18+
project/build/target
19+
project/build/lib_managed
20+
project/build/src_managed
21+
project/plugins/lib_managed
22+
project/plugins/target
23+
project/plugins/src_managed
24+
project/plugins/project
25+
26+
core/lib_managed
27+
core/target
28+
pubsub/lib_managed
29+
pubsub/target
30+
31+
# eclipse specific
32+
.metadata
33+
jrebel.lic
34+
.settings
35+
.classpath
36+
.project
37+
38+
.ensime*
39+
*.sublime-*
40+
.cache
41+
42+
# intellij
43+
*.eml
44+
*.iml
45+
*.ipr
46+
*.iws
47+
.*.sw?
48+
.idea

scruffy/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#Scruffy Benchmarking Test
2+
3+
This is the Scruffy portion of a [benchmarking test suite](../) comparing a variety of web development platforms.
4+
5+
## Infrastructure Software Versions
6+
7+
The tests were run with:
8+
9+
* [Java OpenJDK 1.7.0_09](http://openjdk.java.net/)
10+
* [Scruffy 1.4.15](http://scruffy-project.github.io/)
11+
12+
## Test URLs
13+
14+
### Test type 1: JSON serialization
15+
16+
http://localhost:8080/json
17+
18+
This example uses the built-in Jackson for json support.
19+
20+
* [Test 1 source](src/main/scala/scruffy/examples/Test1Endpoint.scala)
21+
22+
### Test type 2: Single database query
23+
24+
This example uses casbah for Mongo queries. Future improvement would be to switch to a nonblocking library.
25+
26+
* [Test 2 source](src/main/scala/scruffy/examples/Test2Endpoint.scala)
27+
28+
http://localhost:8080/db
29+
30+
### Test type 6: Plaintext
31+
32+
http://localhost:8080/plaintext
33+
34+
* [Test 6 source](src/main/scala/scruffy/examples/Test6Endpoint.scala)

scruffy/__init__.py

Whitespace-only changes.

scruffy/benchmark_config

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"framework": "scruffy",
3+
"tests": [{
4+
"default": {
5+
"setup_file": "setup",
6+
"json_url": "/json",
7+
"db_url": "/db",
8+
"plaintext_url": "/plaintext",
9+
"port": 8080,
10+
"approach": "Realistic",
11+
"classification": "Micro",
12+
"database": "MongoDB",
13+
"framework": "scruffy",
14+
"language": "Scala",
15+
"orm": "Raw",
16+
"platform": "Netty",
17+
"webserver": "None",
18+
"os": "Linux",
19+
"database_os": "Linux",
20+
"display_name": "scruffy",
21+
"notes": "",
22+
"versus": "Netty"
23+
}
24+
}]
25+
}

scruffy/build.sbt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name := "scruffy-benchmark"
2+
3+
organization := "com.sksamuel.scruffy"
4+
5+
scalaVersion := "2.11.1"
6+
7+
version := "1.0.1"
8+
9+
libraryDependencies ++= Seq(
10+
"com.sksamuel.scruffy" %% "scruffy-server" % "1.4.15",
11+
"org.mongodb" %% "casbah-core" % "2.7.1"
12+
)
13+
14+
sbtassembly.Plugin.assemblySettings

scruffy/install.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
fw_depends java

scruffy/project/build.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sbt.version=0.13.2

scruffy/project/plugins.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.11.2")

scruffy/setup.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
import subprocess
3+
import sys
4+
import time
5+
import os
6+
7+
def start(args, logfile, errfile):
8+
if os.name == 'nt':
9+
subprocess.check_call('"..\\sbt\\sbt.bat" assembly', shell=True, cwd="scruffy", stderr=errfile, stdout=logfile)
10+
else:
11+
subprocess.check_call("../sbt/sbt assembly", shell=True, cwd="scruffy", stderr=errfile, stdout=logfile)
12+
13+
subprocess.Popen("java -jar target/scala-2.11/scruffy-benchmark-assembly-1.0.1.jar -Dhostname" + args.database_host,
14+
cwd="scruffy",
15+
shell=True,
16+
stderr=errfile,
17+
stdout=logfile)
18+
time.sleep(5)
19+
return 0
20+
21+
def stop(logfile, errfile):
22+
if os.name == 'nt':
23+
subprocess.check_call("wmic process where \"CommandLine LIKE '%scruffy-benchmark%'\" call terminate", stderr=errfile, stdout=logfile)
24+
else:
25+
p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
26+
out, err = p.communicate()
27+
for line in out.splitlines():
28+
if 'scruffy-benchmark' in line:
29+
try:
30+
pid = int(line.split(None, 2)[1])
31+
os.kill(pid, 15)
32+
except OSError:
33+
pass
34+
35+
return 0

scruffy/source_code

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
./scruffy/src/main/scala/scruffy/examples/
2+
./scruffy/src/main/scala/scruffy/examples/Main.scala
3+
./scruffy/src/main/scala/scruffy/examples/Test1Route.scala
4+
./scruffy/src/main/scala/scruffy/examples/Test6Route.scala

0 commit comments

Comments
 (0)