Skip to content

Commit

Permalink
Merge branch 'release/0.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasKunze committed Apr 18, 2014
2 parents f1a8d73 + 7d03189 commit 0d197ef
Show file tree
Hide file tree
Showing 87 changed files with 4,779 additions and 164 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ bin/

# backup files
*~

# config file
config.txt
81 changes: 81 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# urlMappingServer

server for URL mapping to entities

## Installation

There is an installation script `install.sh` that installs the server.
It uses variables set in `installConfig.sh` to copy the server config and create necessary directories. Change this file to match your needs.

The next step is to create a configuration file for the server.
It is expected to be `config.txt` and is not present by default.
There is a sample config `sample-config.txt` you can use.

cp sample-config.txt config.txt

Change this file to match your needs, too, and finally install the URL mapping server with

run ./install.sh

### Default paths
* database directory: /usr/share/metalcon/urlMappingServer/db
* config path: /usr/share/metalcon/urlMappingServer/config.txt

## Run

You can simply call

./run.sh

to start the server. It then expects the configuration file to be placed at it's default path.
If this is not the case you can pass the configuration file path as an argument.

./run.sh /anywhere/myconfig.file

## Benchmark

[The benchmark](src/test/java/de/metalcon/urlmappingserver/LocalBenchmark.java) was executed with 2GB memory for the Java VM.

### Benchmark without persistence layer

#### Write
>total number: 500,000
>benchmark duration (write): 18754ms
>per write: 37µs
>writes per second: 26660.978991148557

#### Read
>total number: 5,000,000
>benchmark duration (read): 9136ms
>per read: 1827ns
>reads per second: 547285.4640980735
### Benchmark with persistence layer (levelDB)

#### Write (call API locally)
>total number: 500,000
>benchmark duration (write): 28946ms
>per write: 57µs
>writes per second: 17273.543840254268
#### Read (call API locally)
>total number: 5,000,000
>benchmark duration (read): 9841ms
>per read: 1968ns
>reads per second: 508078.44731226505
The server was stopped and restarted, making it load all mappings from disk.

#### Write (restore from disk)
>total number: 500,000
>benchmark duration (restart): 31348ms
>per write: 62µs
>writes per second: 15949.980860022968
#### Read (call API locally)
>total number: 5,000,000
>benchmark duration (read): 13263ms
>per read: 2652ns
>reads per second: 376988.61494382867
40 changes: 40 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
configFile="installConfig.sh"

# check for installation config
if [ ! -e "$configFile" ]
then
echo "Installation config not found: $configFile"
exit 1
fi

source $configFile
CONFIG_NAME="config.txt"

# check for server config
if [ ! -e "$CONFIG_NAME" ]
then
echo "URL mapping server config not found: \"$CONFIG_NAME\""
echo "edit \"sample-config.txt\" to match your needs and do"
echo "cp sample-config.txt $CONFIG_NAME"
exit 1
fi

echo "server directory is \"$SERVER_DIR\""
if [ ! -e "$SERVER_DIR" ]
then
# create server directory
echo "directory not present, creating..."
sudo mkdir -p $SERVER_DIR
fi

# set directory rights
sudo chown -R $SERVER_DIR_RIGHTS $SERVER_DIR
echo "set directory rights to \"$SERVER_DIR_RIGHTS\""

# reset server files
rm -rf $SERVER_DIR/*
echo "server directory cleaned"

cp $CONFIG_NAME $CONFIG_PATH
echo "server config is \"$CONFIG_PATH\""

7 changes: 7 additions & 0 deletions installConfig.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# path to server config
CONFIG_PATH="/usr/share/metalcon/urlMappingServer/config.txt"
# directory for server files
SERVER_DIR="/usr/share/metalcon/urlMappingServer"

# rights for server directory
SERVER_DIR_RIGHTS="`whoami`:`whoami`"
69 changes: 51 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,76 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>de.metalcon</groupId>
<artifactId>tomcat-pom</artifactId>
<version>0.0.1</version>
<artifactId>pom</artifactId>
<version>0.0.9</version>
</parent>

<modelVersion>4.0.0</modelVersion>
<artifactId>url-mapping-server</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>0.5.0</version>

<repositories>
<!-- Metalcon repository to resolve dependencies from -->
<repository>
<id>metalcon-depend</id>
<url>http://metalcon2.physik.uni-mainz.de:8080/mvn/</url>
<url>http://develop.metalcon.de:8080/mvn/</url>
</repository>
</repositories>

<properties>
<!-- version of server API -->
<api.version>0.0.1-SNAPSHOT</api.version>

<!-- version of JeroMQ -->
<jeromq.version>0.3.2</jeromq.version>
<java.exec.launcherClass>de.metalcon.urlmappingserver.UrlMappingServer</java.exec.launcherClass>

<!-- version of levelDB -->
<leveldb.version>1.7</leveldb.version>
<!-- version of logging tool -->
<slf4j.version>1.7.5</slf4j.version>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkMode>pertest</forkMode>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<!-- Url Mapping Server API -->
<!-- URL Mapping Server API -->
<dependency>
<groupId>de.metalcon</groupId>
<artifactId>url-mapping-server-api</artifactId>
<version>${api.version}</version>
<version>${metalcon.urlMappingServer.api.version}</version>
</dependency>
<!-- ZMQ communicator to middleware -->
<dependency>
<groupId>de.metalcon</groupId>
<artifactId>zmq-worker-helper</artifactId>
<version>${metalcon.zmqWorkerHelper.version}</version>
</dependency>

<!-- ZeroMQ implementation JeroMQ for Java -->

<!-- database for persistence -->
<dependency>
<groupId>org.fusesource.leveldbjni</groupId>
<artifactId>leveldbjni-all</artifactId>
<version>${leveldb.version}</version>
</dependency>
<!-- logging tool -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>

<!-- testing framework -->
<dependency>
<groupId>org.zeromq</groupId>
<artifactId>jeromq</artifactId>
<version>${jeromq.version}</version>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
</project>
1 change: 1 addition & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mvn exec:java -Dexec.args="$@"
2 changes: 2 additions & 0 deletions sample-config.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
endpoint = tcp://127.0.0.1:12666
database_path = /usr/share/metalcon/urlMappingServer/db
Loading

0 comments on commit 0d197ef

Please sign in to comment.