From 84840c7aaa1dc6eea4b2e009088955f4c94abd5f Mon Sep 17 00:00:00 2001 From: jaehyeon-kim Date: Fri, 17 Nov 2017 22:20:57 +1100 Subject: [PATCH] README up --- README.md | 31 +++++++++++++++++++++++++++++++ note.txt | 9 --------- 2 files changed, 31 insertions(+), 9 deletions(-) create mode 100644 README.md delete mode 100644 note.txt diff --git a/README.md b/README.md new file mode 100644 index 0000000..493c619 --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +## R API DEMO + +Investigate API Development with R - [plumber](https://github.com/trestletech/plumber), [Rserve](https://www.rforge.net/Rserve/) and [rApache](http://rapache.net/). + +### Docker + +``` +## build +docker build -t=api ./api/. + +## run +# rApache - 7000, Rserve - 8000, plumber - 9000 +# all APIs managed by supervisor +docker run -d -p 7000:80 -p 8000:8000 -p 9000:9000 --name api api:latest +``` + +### CURL + +``` +# change port accordingly +curl -H "Content-Type: application/json" -X POST -d '{"n": 10, "wait": 0.5}' http://localhost:7000/test +``` + +### Performance Test + +``` +## locust - only available for Python 2 +# pip install locustio + +locust -f ./locustfile.py --host http://localhost:7000 --no-web -c 1 -r 1 +``` \ No newline at end of file diff --git a/note.txt b/note.txt deleted file mode 100644 index 4d23b03..0000000 --- a/note.txt +++ /dev/null @@ -1,9 +0,0 @@ -docker build -t=api ./api/. -docker run -d -p 7000:80 -p 8000:8000 -p 9000:9000 --name api api:latest - -docker build -t=locust ./locust/. -docker run --rm -it --name locust locust "locust -f /root/locustfile.py --host http://localhost --no-web -c 1 -r 1" - -curl -H "Content-Type: application/json" -X POST -d '{"n": 10, "wait": 0.5}' http://localhost:7000/test -curl -H "Content-Type: application/json" -X POST -d '{"n": 10, "wait": 0.5}' http://localhost:8000/test -curl -H "Content-Type: application/json" -X POST -d '{"n": 10, "wait": 0.5}' http://localhost:9000/test