LIGHT

  • News
  • Docs
  • Community
  • Reddit
  • GitHub

Performance

In the previous step, we’ve updated project with H2 database to perform the unit test without any external database. In this step, we are going to run some performance test with wrk in Docker to give you a ballpark how fast this database demo is.

We are not going to run it on a real testing server with service and database separated on two physical machines. Everything here is on my desktop with an AMD 2700x CPU.

Before we start the test, we need to bring up the server in the test folder as we have the Postgres configured.

cd ~/networknt/light-example-4j/rest/swagger/database/test
mvn clean install exec:exec

To test the endpoint on your localhost, use the following command. You cannot use localhost, so you have to find out your IP address.

You can use ifconfig to find your local IP address. My local IP is 192.168.1.144 and you need to replace it with your IP in the following docker command line.

docker run --rm williamyeh/wrk -t4 -c50 -d30s --timeout 2s https://192.168.1.144:8443/v1/query

Here is the result.

steve@freedom:~$ docker run --rm williamyeh/wrk -t4 -c50 -d30s --timeout 2s https://192.168.1.144:8443/v1/query
Unable to find image 'williamyeh/wrk:latest' locally
latest: Pulling from williamyeh/wrk
4fe2ade4980c: Already exists 
c4d7e348633d: Pull complete 
3e403d3ebdda: Pull complete 
bdb672ee55d9: Pull complete 
2bfb714176a4: Pull complete 
Digest: sha256:78adc0d9d51a99e6759e702a08d03eaece81c890ffcc9790ef9e5b199d54f091
Status: Downloaded newer image for williamyeh/wrk:latest
Running 30s test @ https://192.168.1.144:8443/v1/query
  4 threads and 50 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     1.77ms    9.53ms 229.90ms   99.05%
    Req/Sec    13.37k     2.99k   16.01k    91.02%
  1569848 requests in 30.01s, 215.89MB read
Requests/sec:  52305.78
Transfer/sec:      7.19MB

As we are using Postgres docker container and its maximum connection can only reach 100. If you can increase the connection pool size, you can get even better performance.

So far you have gone through the important area with database access, there are other topics related to the database, but they are out of the scope of this simple tutorial. If you have questions on SQL DB access or NoSQL DB access, please take a look at other examples in light-example-4j

  • About Light
    • Overview
    • Testimonials
    • What is Light
    • Features
    • Principles
    • Benefits
    • Roadmap
    • Community
    • Articles
    • Videos
    • License
    • Why Light Platform
  • Getting Started
    • Get Started Overview
    • Environment
    • Light Codegen Tool
    • Light Rest 4j
    • Light Tram 4j
    • Light Graphql 4j
    • Light Hybrid 4j
    • Light Eventuate 4j
    • Light Oauth2
    • Light Portal Service
    • Light Proxy Server
    • Light Router Server
    • Light Config Server
    • Light Saga 4j
    • Light Session 4j
    • Webserver
    • Websocket
    • Spring Boot Servlet
  • Architecture
    • Architecture Overview
    • API Category
    • API Gateway
    • Architecture Patterns
    • CQRS
    • Eco System
    • Event Sourcing
    • Fail Fast vs Fail Slow
    • Integration Patterns
    • JavaEE declining
    • Key Distribution
    • Microservices Architecture
    • Microservices Monitoring
    • Microservices Security
    • Microservices Traceability
    • Modular Monolith
    • Platform Ecosystem
    • Plugin Architecture
    • Scalability and Performance
    • Serverless
    • Service Collaboration
    • Service Mesh
    • SOA
    • Spring is bloated
    • Stages of API Adoption
    • Transaction Management
    • Microservices Cross-cutting Concerns Options
    • Service Mesh Plus
    • Service Discovery
  • Design
    • Design Overview
    • Design First vs Code First
    • Desgin Pattern
    • Service Evolution
    • Consumer Contract and Consumer Driven Contract
    • Handling Partial Failure
    • Idempotency
    • Server Life Cycle
    • Environment Segregation
    • Database
    • Decomposition Patterns
    • Http2
    • Test Driven
    • Multi-Tenancy
    • Why check token expiration
    • WebServices to Microservices
  • Cross-Cutting Concerns
    • Concerns Overview
  • API Styles
    • Light-4j for absolute performance
    • Style Overview
    • Distributed session on IMDG
    • Hybrid Serverless Modularized Monolithic
    • Kafka - Event Sourcing and CQRS
    • REST - Representational state transfer
    • Web Server with Light
    • Websocket with Light
    • Spring Boot Integration
    • Single Page Application
    • GraphQL - A query language for your API
    • Light IBM MQ
    • Light AWS Lambda
    • Chaos Monkey
  • Infrastructure Services
    • Service Overview
    • Light Proxy
    • Light Mesh
    • Light Router
    • Light Portal
    • Messaging Infrastructure
    • Centralized Logging
    • COVID-19
    • Light OAuth2
    • Metrics and Alerts
    • Config Server
    • Tokenization
    • Light Controller
  • Tool Chain
    • Tool Chain Overview
  • Utility Library
  • Service Consumer
    • Service Consumer
  • Development
    • Development Overview
  • Deployment
    • Deployment Overview
    • Frontend Backend
    • Linux Service
    • Windows Service
    • Install Eventuate on Windows
    • Secure API
    • Client vs light-router
    • Memory Limit
    • Deploy to Kubernetes
  • Benchmark
    • Benchmark Overview
  • Tutorial
    • Tutorial Overview
  • Troubleshooting
    • Troubleshoot
  • FAQ
    • FAQ Overview
  • Milestones
  • Contribute
    • Contribute to Light
    • Development
    • Documentation
    • Example
    • Tutorial
“Performance” was last updated: June 1, 2019: fixes #103 migrate the database tutorial from Swagger 2.0 to OpenAPI 3.0 (#104) (8ebbc59)
Improve this page
  • News
  • Docs
  • Community
  • Reddit
  • GitHub
  • About Light
  • Getting Started
  • Architecture
  • Design
  • Cross-Cutting Concerns
  • API Styles
  • Infrastructure Services
  • Tool Chain
  • Utility Library
  • Service Consumer
  • Development
  • Deployment
  • Benchmark
  • Tutorial
  • Troubleshooting
  • FAQ
  • Milestones
  • Contribute