Tags

Front End

Making An Efficient Micro Service Web Application with Docker and Spring Cloud    

WHAT’S THE ISSUE?

Web applications have become a necessity to many people around the world with many uses including work and personal.

As web applications and hardware become more advanced, user expectations also change too. From speed and fluency to security, these expectations can “Make or break an application's success”. Luckily for web application developers, there have been helpful updates and creations to help them fulfil and exceed these expectations.

Netflix decided to take a major lead in creating fast and reliable Web Applications by creating their own solution based on the top of Spring Boot with Spring Cloud. An MVC framework created to allow the creation or Web Applications with Microservices, Spring Cloud is a framework that provides many tools to allow you to create a fast and secure web application.

A Microservice Architecture consists of individual services which possess a specific role. For example, on a social media platform, you may have a specific set of services to handle Authentication. An example of this would be an Authentication server for OAuth. This would be accompanied by another service to handle the creation of a user in a Database. One of the many benefits of this is to allow the removal and addition of a replacement or altered service whilst causing little disturbance to the overall application. A good example of this is creating some form of payment service. If a change to payment provider is required, then you can simply “unplug” and “Plugin” the new service.

HOW DOES THIS WORK?

Spring Cloud offers extremely useful tools to help you achieve this, the most important being “Eureka”. Eureka is a service locator which acts as a clocking in machine for the services. Once a service is initialised or loaded, it reports to Eureka and informs it or its location and name. Spring cloud offers another accompanying tool called “Zuul”, this is a Gateway service which accepts RESTful requests. Zuul will take the request and query Eureka to find the location of the target service. From this query it will then be able to continue the request to the target Service. If the target service is for some reason missing, Zuul handles this in its response therefore keeping the application running with only some features missing.

HOW DOES THIS IMPROVE SECURITY?

Think of the general format of a monolithic Web Application, it may include a front-end (Website), a service layer and a Database. For someone who would like to access this database there is the front-end, then once through to the service layer they can gain the Database details.

In a Micro Service architecture you have the ability to add many layers, you also have the ability to externalise the configuration to a private repository somewhere such as GitHub. This is achieved by using the Config Service also provided by Spring Cloud. When a service initialises, it contacts the Config service to request that it locates the configuration values it requires to perform. The Config service then locates these values from your private repository. This service can have access restricted in your cloud architecture so that it is buried deep. Essentially you are forcing access credentials to spread out and externalise with added security access in place. You also have the ability to split the Database if you are using a Non-Relational style database. Which would mean someone with malicious intent would not be able to access the whole data.

HOW DOES DOCKER PLAY A PART?

Docker is a fantastic tool used to create services and also allow for speedy deployments. By creating individual containers to run the Java application for the service, you have a working environment which can be taken, shared or deployed. In my experience using tools such as Amazon ECS to deploy your containers is extremely beneficial and allows for not only added security and availability, but adds version control of a full service. It also means you have access to control the individual services as a collective and monitor the performance as well as the availability of the application. Not just all of this but these tools also offer Auto-Scalability to handle performance under stress. Without much physical maintaining this can be achieved as many services such as ECS offer this all automatically once you configure the rules. Docker images can be created as part of a Java build cycle using Maven etc. Or as part of your build process. In experience “com.spotify” has a Docker plugin adds a great facility to manage your Docker build as part of the build cycle.

IS IT COST EFFECTIVE?

A Micro Service Architecture is as cost effective as you make it. Many services can generally be run at low hardware requirements but as a collective it may match that of a monolithic application. The benefit is that you can adjust it depending on load easily with scaling of the specific services or collective to reduce the hardware requirements and allow the auto scale to handle the rules you place to set limits and minimum requirements. Also there is very little outage time as many tools allow for High Availability which includes relaunching a service or service once it has failed.

WHY SHOULD I USE THIS PATTERN?

For many organisations and tools the added benefits of security, speed, availability and scalability can offer much needed requirements which fulfil the expectations of an advancing user-base, whilst adding future-proofing to a variety or performance and security risks. All for similar costs and potentially reduced maintenance.

By Steven Skedge www.stevenskedge.co.uk

Credit to:

  • Spring Cloud

http://projects.spring.io/spring-cloud/

https://cloud.spring.io/spring-cloud-netflix/

  • Docker 

https://www.docker.com/

  • Spotify Docker plugin

https://github.com/spotify/docker-maven-plugin

  • Amazon ECS

https://aws.amazon.com/ecs/?sc_channel=PS&sc_campaign=acquisition_UK&sc_publisher=google&sc_medium=ecs_b&sc_content=ecs_general_bmm&sc_detail=%2Baws%20%2Becs&sc_category=ecs&sc_segment=159785768561&sc_matchtype=b&sc_country=UK&s_kwcid=AL!4422!3!159785768561!b!!g!!%2Baws%20%2Becs&ef_id=Wq@nHgAABI7rtiPO:20180319120342:s

Who Are Ronald James?

We are a leading niche digital & tech recruitment specialist for the North East of England. We Specialise in the acquisition of high-performing technology talent across a variety of IT sectors including Digital & Technology Software Development.

Our ultimate goal is to make a positive impact on every client and candidate we serve - from the initial call and introduction, right up to the final delivery, we want our clients and candidates to feel they have had a beneficial and productive experience.

Contact our Team

If you’re looking to start your journey in sourcing talent or find your dream job, you’ll need a passionate, motivated team of experts to guide you. Check out our Jobs page for open vacancies. If interested, contact us or call 0191 300 6501 for a quick chat with our team.

Let's be Friends!

Follow us on our blog, Facebook, LinkedIn, Twitter or Instagram to follow industry news, events, success stories and new blogs releases.

 

Back to Blog

</Follow Us>