how the hell do i run my microservices in production, and will it scale?

51
Daniël van Gils @foldingbeauty [email protected] www.cloud66.com How the hell do I run Microservice in Production?... and will it scale?

Upload: daniel-van-gils

Post on 21-Mar-2017

144 views

Category:

Technology


1 download

TRANSCRIPT

Daniël van Gils @foldingbeauty [email protected]

www.cloud66.com

!

"

How the hell do I run Microservice in Production?...

and will it scale?

= public/private/hybrid = yours

Services

#

> 4000 serversEasy Ops tools build for Devs

$

%#

%%

$

%#

%%

$

%#

%%

$

%#

%%

NOISE

$docker run alpine echo 'hello world’

production

?

$docker-compose up -d

time

skill

s

&

%

#

#1 the right container image

#2 containers in production

%%

%

''

containers

% %%%%%

%

bin/libs

os

&

bin/libs bin/libs

(

)

*+

&

'server

os

bin/libs

)

,

''

cloud/VM

os

bin/libs

&

(

)

'os

bin/libs

(

)

cloud/VM

&

(

)

*+

containers

&&)

server

dev

ops

ops

ops

dev dev,

$ service

% containers

server cluster(s)'

image%#

%%

= code

= docker file

= docker engine

= platform

%

build

ship

deploy

&containerisation

(

)

*+

the containerisation machine

%%%

(you can’t polish a turd

&

%

containerisation

)

*-

%%% =

%#

“The right image should be the same in all your environments.”

%#

“I didn't have time to create a slim image, so I created a fat one instead.”

%#

“The right image need at least 5 kisses” kiss = keep an image s…, smart ass

slim secure speedy stable set

SLIM Start with the smallest minimal image you can find and trust. Remove compile time dependencies. Remove packages you don’t need. Squash layers to reduce size. Run stats for the image. habitus.io

%#

SLIM SECURE SPEEDY STABLE

SET

%#

SECURE Remove all the secrets. Patch to the latest security updates. Run the image with the right UID. Test the image. https://github.com/docker/docker-bench-security

%#

SMALL SECURE SPEEDY STABLE

SET

%#

SPEEDY Optimise code. Memory and cpu usage. One process. Load testing.

%#

SLIM SECURE SPEEDY STABLE

SET

%#

STABLE Lock the image version. Lock the runtime version(s). Tag your image. Proper logging.

%#

SLIM SECURE SPEEDY STABLE

SET

%#

SET Use volumes wisely, use external services for persistency, don’t abuse host system. Loosely coupled. Remove things which are hard to maintain in production.

%#

&

%

#

#1 the right container image

#2 containers in production

%%

#Minimal Lovable Service Image

Reality Check!

$

%#

% /

monolith containerisation ± 70 % (multi tetant)

monolith 1x

monolith image FAT

$

%#

%

/

API first containerisation ± 20%

%#

%api 1x

frontend 1x

image frontend FAT

image api FAT

$

%#

%

/

splitting monolith containerisation ± 6%

%#api 6x

frontend 1x %#

%

workers 10x

%%%%%%%%%

image frontend FAT

image api THIN

image workers THIN

%%%%%%

$

%#

0/

%#A 6x

B 12x %#

%

C 10x

%%%%%%%%%

image B THIN

image A THIN

image C THIN

%%%%%%

microservice architecture ± 4%

%%%%%%%

%%%%%

message queue

Choose your platform wisely.

LIFE CYCLE

%#ORCHESTRATION DISCOVERY

SECURITY

SCALING

DATA MANAGEMENT

MONITORING

SCHEDULING

LIFE CYCLE

%#ORCHESTRATION DISCOVERY

SECURITY

SCALING

DATA MANAGEMENT

MONITORING

SCHEDULING

LIFECYCLE Have an image guideline. Create a workflow using the same image in all the software cycle stages. From design to production mimic the environment. Test heavily.

1/

LIFE CYCLE

%#ORCHESTRATION DISCOVERY

SECURITY

SCALING

DATA MANAGEMENT

MONITORING

SCHEDULING

ORCHESTRATION Provisioning nodes. Networking. Isolation of services. Self healing. iOi = Infrastructure on Infrastructure.

12

LIFE CYCLE

%#ORCHESTRATION DISCOVERY

SECURITY

SCALING

DATA MANAGEMENT

MONITORING

SCHEDULING

DISCOVERY Find your services and datasources with minimal code change. Versioning of running services. Automagically update discovery when services come and go.

13

LIFE CYCLE

%#ORCHESTRATION DISCOVERY

SECURITY

SCALING

DATA MANAGEMENT

MONITORING

SCHEDULING

SCALING/SCHEDULING Scale your service (= more running containers). Scale your nodes. Scale your on/off jobs. Failover groups. Hybrid infrastructure. Load balancing.

14

LIFE CYCLE

%#ORCHESTRATION DISCOVERY

SECURITY

SCALING

DATA MANAGEMENT

MONITORING

SCHEDULING

DATA MANAGEMENT Backup and restores. Clustering. Verify your backups.

1

LIFE CYCLE

%#ORCHESTRATION DISCOVERY

SECURITY

SCALING

DATA MANAGEMENT

MONITORING

SCHEDULING

MONITORING Get all the statistics of resources (mem/load/net/res) used. Aggregating of logs. Key debugging ingredient.

15

LIFE CYCLE

%#ORCHESTRATION DISCOVERY

SECURITY

SCALING

DATA MANAGEMENT

MONITORING

SCHEDULING

SECURITY Node and Engine level. Intrusion detection and prevention systems. DoS protection. Firewall. Segregate container groups Verification of images.

11

Choose your platform wisely.

When you get DevOps right, Microservices architecture right and creating the right minimal lovable Image and having the right platform to run containers. Happy Camper.#

www.cloud66.com blog.cloud66.com habitus.io startwithdocker.com

Daniël van Gils @foldingbeauty [email protected]

www.cloud66.com

!

"

```

%#