-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
87 changed files
with
4,779 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,6 @@ bin/ | |
|
||
# backup files | ||
*~ | ||
|
||
# config file | ||
config.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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\"" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mvn exec:java -Dexec.args="$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.