Presentation is loading. Please wait.

Presentation is loading. Please wait.

Microservices on application container cloud service

Similar presentations


Presentation on theme: "Microservices on application container cloud service"— Presentation transcript:

1 Microservices on application container cloud service
Maarten Smeets

2 Integration consultant at AMIS since 2014
About Maarten Integration consultant at AMIS since 2014 Several certifications SOA, BPM, MCS, Java, SQL, PL/SQL, Mule, AWS, etc Enthusiastic blogger @MaartenSmeetsNL

3 Nominate yourself or someone you know: acenomination.oracle.com
500+ Technical Experts Helping Peers Globally 3 Membership Tiers Oracle ACE Director Oracle ACE Oracle ACE Associate Connect: bit.ly/OracleACEProgram Facebook.com/oracleaces @oracleace Nominate yourself or someone you know: acenomination.oracle.com

4 Microservices on Application container cloud service
architecture Twelve factor Application Application container Cloud service Spring boot Documenting your api Using the ACCS cache with the ACCS Java SDK Deploying and running On ACCS

5 Microservice architecture in the cloud

6 Microservice architecture in the cloud the challenges are different from on premises
Environment differs Administration, connectivity Security The entire world can access your services DTAP environments Local development / testing? Scalability

7 Twelve factor application HOW
Codebase Backing services One codebase tracked in revision control, many deploys Treat backing services as attached resources Dependencies Build, release, run Explicitly declare and isolate dependencies Strictly separate build and run stages Config Processes Store config in the environment Execute the app as one or more stateless processes

8 Twelve factor application HOW
Port binding Dev/prod parity Export services via port binding Keep environments as similar as possible Concurrency Logs Scale out via the process model Treat logs as event streams Disposability Admin processes Maximize robustness with fast startup and graceful shutdown Run admin/management tasks as one-off processes

9 Application Container
Microservice architecture in the cloud 12 factor application: A methodology for building SaaS apps Smooth transition from dev to prod Easy integration with underlying platform ACCS is more GUI based and Heroku is more commandline / configuration file based. Deployment to Heroku is much faster! Application Container Cloud Service

10 Application container cloud service
On demand scale out/in. Adding/Removing instances On demand scale up/down. Adding/Removing memory per instance Automatic load balancer configuration One click patching Easy to configure service bindings

11 Application container cloud service
Why is this my favorite cloud service? Clean contract, language independent

12 Implementing microservices many choices
Example Java SE, Spring Boot

13 Spring boot but why? Popular Java is very popular! #1 TIOBE index #3 on Stackoverflow and Github Netflix uses it Rich in features Uses Spring but with many shortcuts. Spring provides a lot of out of the box functionality such as integration and security Performant Spring Boot outperforms JavaScript on Node if you do the same things Like validation, authentication, formatting Fast to develop Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can "just run". Performance: Na application server required. Ideal to just run a Jar in a Docker container Netflix uses it Spring is a solid framework a large codebase many contributors Spring Boot makes using Spring easy by taking an opinionated view Minimal configuration required for 80% of the use cases Designed to get you up and running as quickly as possible. Does not require an application server (has embedded Tomcat) You just need a JVM to run

14 Spring boot implementing microservices
Documentation Spring Boot on ACCS Spring Boot on Docker Using the Application Cache

15 Spring boot Documentation
Contract first (design first) Generate Spring Boot code using Smartbear Swaggerhub You can even generate code from your Maven build using swagger-codegen Internal API’s -> code first External API’s -> design first. Better communication and better experience Useful for quick stub generation

16 Spring boot Documentation
Code first Generate Swagger documentation from annotations code using springfox.io libraries

17 Spring boot documentation code First
Add dependencies to pom.xml Create Swagger configuration class Annotate your API’s

18 Spring boot documentation
Add the SpringFox dependency to the pom.xml

19 Spring boot documentation
Which APIs to generate documentation for

20 Spring boot documentation
Describes the API Describes the API operation

21 Spring boot documentation

22 Spring boot documentation
Easy to import Swagger documentation in a tool like Postman

23 Use dockerfile-maven-plugin
Spring boot on docker Why? To test locally Create a Dockerfile Use dockerfile-maven-plugin In your pom.xml

24 Spring boot on Docker Get base images from public registries
OpenJDK on Alpine Linux Oracle JDK on Oracle Linux First is easy. No need to create accounts, works out of the box Second requires an account on store.docker.com and requires you to accept a license ACCS is OEL7 Why? To test locally + +

25 Spring boot on Docker Dockerfile mvn package dockerfile:build
Add Dockerfile. Specifies container base mvn package dockerfile:build docker run -p 8081:8081 maartensmeets/accs-cache-sample:latest

26 Spring boot on Docker: different from ACCS
There is no local ACCS environment You cannot test deployment locally ACCS bindings cannot be tested locally LocalSessionProvider is available for the cache The local environment differs. No loadbalancer, no internal and external hostnames Cache can be unittested

27 build a zip to deploy to accs
What should be in the ZIP How do you create those files

28 Spring boot on ACCS build a deployable
ACCS Deployable ZIP manifest.json deployment.json uberJAR.jar Create with the maven-assembly-plugin Create with the spring-boot-maven-plugin

29 Spring boot on ACCS build a deployable
Describes what should go in the ZIP file for ACCS JAR + manifest.json + deployment.json Creates a Spring Boot über JAR with dependencies which ‘just runs’

30 Spring boot on ACCS deploy! manually

31 Spring boot on ACCS deploy! Developer cloud service

32 Using the application cache
Create an application cache How to access the cache using the Java SDK

33 Using the application cache but why?
Share state Cache slow service responses between technologically diverse stateless services like session data

34 Using the application cache
Java SE App 1 Java SE App 1 Java SE App 3 Node JS App 1 Multiple apps can use the same application cache. A single app can use a single application cache Application cache runs on Coherence Useful for sharing session state across apps or app nodes. Application Cache 1 Application Cache 2 Customers Shopping carts Inventory Customers Shopping carts Inventory

35 Using the application cache how fast is it?
Environment ACCS: 1 OCPU, 1 Gb Cache: 2Gb Basic Tested with GET request, small payload Average response time for 3500 requests, 20 threads, 60s End to end: 236ms (no significant difference REST / GRPC) GRPC: 5ms (1ms - 40ms) REST: 3ms (0ms - 70ms) Local: 0ms

36 Using the application cache

37 Using the application cache
The cache name should not contain characters like ‘-’ This will cause the creation to fail (specifically LBaaS configuration)

38 Using the application cache
Or in the deployment.json file or by manually adding a binding This does two things Ensuring there is secure network connectivity to the cache Make connection information to the cache available as parameters inside the Docker env

39 Using the application cache dependency challenges
Java 9 lacks some libraries from previous SDK’s Additional dependencies needed Additional GRPC libraries are required

40 Using the application cache in spring boot
Controller Exposes resources / presentation E.g. RestController Implement logic to use the cache or another repository Service Service / operation Implement cache code Repository Handles connectivity / persistence / DAO Entity The resource

41 Using the application cache in spring boot
Oracle provides an open source SDK Java Client Caching SDK for Oracle Application Container Cloud Service Also allows local development

42 Using the application cache in spring boot
Service DbRepository CacheRepository Get requests directly to the cache Put requests to both Cache Loader Serializer

43 Using the application cache in spring boot
Can be a Local or Remote. Remote requires an URL Create a SessionProvider Use the SessionProvider to create a Session Use the Session to get a Cache object Use the Cache object to access the cache The session can be REST or gRPC (HTTP/2) based Oracle provides a client SDK: which has been open sourced: Allows you to configure Expiry Determines validity of cached objects Loader This is called when there is no cache hit Serializer Objects need to be serialized to be put in the cache

44 Application container cloud service good to know
Deployment Sometimes old deployment ZIP files are used Recommendation: script removing files from storage cloud Debugging Can be time-consuming. A single deployment can take minutes. The Java Client SDK does not provide support for a findAll method

45 Application cache good to know
Expiry Has issues with the LocalSessionProvider Tip: set it to never expire Environment differences Working locally is no guarantee for working in the cloud! Dependencies / performance Test with both GRPC and REST. REST could be faster! You can’t remove a cache which has bindings to applications Availability During patches, updating bindings -> implement retries or error handling

46 Want to learn more? Java Python
Complete working sample Spring Boot on ACCS with Application Cache A sample of using the cache. Application is Jersey based (no Spring) Python A minimal sample of using Python on ACCS An elaborate sample of using Python on ACCS Also see

47


Download ppt "Microservices on application container cloud service"

Similar presentations


Ads by Google