The project is created to
-
finish the coding challenge I've raised to @eechen.
-
as companion project for my blog on applying act-aaa plugin in an ActFramework application which demonstrates on the following feature:
- Login/SignUp user
- Send welcome email and handle activation link
- Authentication/Authorisation/Auditing with Act-AAA
- The expressiveness of ActFramework. It takes only 261 lines of Java code to implement this project.
See https://git.oschina.net/greenlaw110/yatl/issues
- It shall allow user to login/sign up
- It shall send welcome letter to user once user signed up
- It shall handle the request when user clicked the activation link in the welcome email.
- It shall redirect user to login form if user hasn't logged in yet
- Once user logged in it shall display a list of TODO items associated with the user
- Each todo item has a subject to be displayed
- It shall allow logged in user to create new TODO item
- It shall allow logged in user to update his TODO item only
- No requirement on styling. Just keep it simple.
- No requirement on database. Choose whatever you want. But data must be persistent
- No need to CSS just use standard HTML element is enough. List shall use
<li>element. The body shall use<textarea>element - Project must provide the build script, deploy script and README file.
You must have MongoDB, JDK7+ and the corresponding JCE installed in order to play with this project. You must install maven to build the application
To build and run the app locally
mvn clean compile exec:execThis will start the app in actframework default port: 5460
To build package for deployment
mvn clean packatgeThis will generate a distribution package in target/dist dir. You can scp the file to your cloud server.
To run the distribution package, unzip it and type ./run
This app require SMTP configurations in order to send out welcome email. Once you are about to run the application, please add the following items into your conf/common/mail.properties:
mailer.smtp.username=${smtpUsername}
mailer.smtp.password=${smtpPassword}
mailer.smtp.host=${smtpHost}
mailer.smtp.port=${smtpPort}
luog@luog-Satellite-P50-A:~/p/greenlaw110/yatl$ loc src
--------------------------------------------------------------------------------
Language Files Lines Blank Comment Code
--------------------------------------------------------------------------------
Java 10 360 78 20 262
HTML 7 161 20 0 141
XML 2 133 21 20 92
JavaScript 2 84 7 2 75
YAML 1 15 3 0 12
Batch 1 7 0 0 7
--------------------------------------------------------------------------------
Total 23 760 129 42 589
--------------------------------------------------------------------------------
Note
- The environment is my local laptop: i7-4700MQ / 16GB RAM / 256 GB SSD / Linuxmint 18.1
- All benchmarks are done using wrk with 4 threads and 256 concurrent connections for 5s. For each benchmark I run a couple of times to warm up the JVM and pick up the best one.
- There are only one user signed up and one item in the user's todo list. This can filter out the impact of the database to a certain extend
| Item | Throughput | Latency |
|---|---|---|
| Display Login Form (no cookie/authentication) | 81,736.26 | 03.35ms |
| Display Home Page (with cookie/authentication) | 14,284.19 | 21.31ms |
| Retrieve login user's TODO list | 11,128.40 | 25.69ms |
luog@luog-Satellite-P50-A:~/p/greenlaw110/microservices-framework-benchmark$ wrk -t4 -c256 -d5s http://localhost:7003/login
Running 5s test @ http://localhost:7003/login
4 threads and 256 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 3.35ms 6.69ms 208.21ms 97.83%
Req/Sec 20.61k 3.03k 33.39k 78.50%
412274 requests in 5.04s, 199.73MB read
Requests/sec: 81736.26
Transfer/sec: 39.60MB
luog@luog-Satellite-P50-A:~/p/greenlaw110/microservices-framework-benchmark$ wrk -t4 -c 256 -d5s -H 'Cookie: yat-session=fdc8c67b58312561b0fc5047bd286c6741e53117-___TS%011490769539386%00___ID%013c462618-466b-4f2f-b001-89407de440dc%00username%01green%40thinking.group' http://localhost:7003
Running 5s test @ http://localhost:7003
4 threads and 256 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 21.31ms 20.57ms 290.55ms 88.52%
Req/Sec 3.61k 295.87 4.64k 72.00%
72064 requests in 5.05s, 127.28MB read
Requests/sec: 14284.19
Transfer/sec: 25.23MB
luog@luog-Satellite-P50-A:~/p/greenlaw110/microservices-framework-benchmark$ wrk -t4 -c 256 -d5s -H 'Cookie: yat-session=fdc8c67b58312561b0fc5047bd286c6741e53117-___TS%011490769539386%00___ID%013c462618-466b-4f2f-b001-89407de440dc%00username%01green%40thinking.group' -H 'Accept: application/json' http://localhost:7003/todo
Running 5s test @ http://localhost:7003/todo
4 threads and 256 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 25.69ms 20.99ms 237.27ms 83.32%
Req/Sec 2.83k 316.90 6.51k 91.00%
56504 requests in 5.08s, 24.63MB read
Requests/sec: 11128.40
Transfer/sec: 4.85MB
Should you have any questions, please comment below or submit an issue.