Skip to content

The City Suggestion API application is simple Spring Boot application implementing a RESTful webservice providing city name suggestions based on a query string.

License

Notifications You must be signed in to change notification settings

4TT1L4/CitySuggestionAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

City Suggestion API

Build Status Quality Gate Status Maintainability Rating

Coverage Technical Debt

Overview

The City Suggestion API application is a simple Spring Boot application, implementing a RESTful web service, providing city name suggestions based on a query string.

For further details about the API, please see the API portal

Preview

Test

Running the application

The application can be started with maven, just use the mvn spring-boot:run command:

starting the application with maven

Using the service

The service provides an HTTP endpoint under "/suggestions". City suggestion queries may be sent to this endpoint via HTTP GET. The query string with the partial name of the city must be passed in the "q" query parameter:

example response in postman

Production Ready Features

The application utilizes the production ready features of the Spring Boot Actuator module.

Ths includes providing a Health Endpoint. The actual state of the application may be queried from the HTTP endpoint under: /actuator/health.

This could be done for example with the following curl command:

curl localhost:8080/actuator/health

API Documentation

The API documentation is also available in the deployed application and can be queried runtime as well:

http://localhost:8080/swagger-ui.html

The web based Swagger UI user interface also provides "try-it-yourself" functionality:

API Documentation UI

The API portal hosted at apimatic.io can be used to generate clients for different programming langauges as well (including Java, C#, Python and many others).

The expected behaviour of the API is also captured by postman based integration tests.

These may be used for integration and system testing purposes.

For details about the postman based integration tests, please see the official postman documentation.

Postman test run

Profiling: Startup and memory usage

On the reference system (Intel Core i7-8700@3.20GHz) the startup took 7 seconds. This may be further optimized, if needed.

The service needs 1 Gb memory. Based on the results of the stress tests, this is enough to get a smooth throughput for a load peeking at 7500 requests/s.

Startup and Memory usage

Load and stress testing

Based on the load and stress tests; the service is capable to handle traffic up to 7500 requests/s on the reference system.

Higher traffic leads to graceful degradation of the response times and the total throughput:

Total response time chart

Throughput chart

If you need to serve higher load, then please consider using several instances of the service using load balancing or even configure auto scaling, especially if dynamic scaling capatibilities are needed as the load increases.

For further details about the load and stress testing please see the attached report.

Source of city names

The data is "GeoNames Gazetteer" dataset. (Licensed under CC Attribution License)

For details see the related readme file and the GeoNames website.

About

The City Suggestion API application is simple Spring Boot application implementing a RESTful webservice providing city name suggestions based on a query string.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published