cisco: application clustering with couchbase – couchbase connect 2016

Download Cisco: Application clustering with Couchbase – Couchbase Connect 2016

Post on 13-Apr-2017

122 views

Category:

Software

2 download

Embed Size (px)

TRANSCRIPT

Here are some photos to get you started.

Clint RickerCouchbase Application Clustering

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential

1

Solutions Architect, Office of the CTOSP VideoMe

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco ConfidentialShipping Couchbase in service provider grade software since 2012Running in mission critical, very large scale on-prem and AAS offerings around the worldDatasets of billions of recordsCisco / Couchbase

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco ConfidentialCreating a clustered application glued together by CouchbaseUse Couchbase / lightweight code snippets instead of common datacenter technologiesReplacing Zookeeper, Eureka, Consul, Rabbit/HornetMQ, etcWhat

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential

WhatApp InstanceApp InstanceApp InstanceCouchbase

App InstanceApp InstanceApp InstanceCouchbaseShared StorageDependent DatabasesZookeeperConsulRabbitMQLoad BalancerLoad Balancer

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco ConfidentialComplexity kills Lower machine countOrganizational needsApplication needsLove of roll your ownVery minimal feature setWhy

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco ConfidentialMore application code to maintainSchema changes are difficultExisting platform stack Less sensitivity to deployment footprintVery minimal feature setWhy not

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco ConfidentialGlobal Distributed Lock

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco ConfidentialGlobal Distributed Lock

Used to ensure certain activities are globally serializedTypically provided by Consul / Zookeeper / etc

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco ConfidentialGlobal Distributed Lock

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco ConfidentialGlobal Distributed Lockuint64_t CBGetLock(char *lockKey, int objectLockTimeout) {

if (status == CBSTATUS_SUCCESS) { for (i = 0; i < retries; i++) { status = CBObjGet(buf, &cas, lockKey,objectLockTimeout); if (status >= 0) { return cas; } } } return CBSTATUS_FAILURE;}

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco ConfidentialLeader Election

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco ConfidentialLeader Election

Used to have a dynamically dedicated master instance for ongoing activityCommon for frequent maintenance needsTypically provided by Consul, Zookeeper, etc

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco ConfidentialLeader Election

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco ConfidentialLeader Electionuint64_t CBElectMasterPrivate(char *masterKey, int ttl, uint64_t masterKeyCas) {

if (masterKeyCas > 0) { status = CBObjReplace(masterKey, "master", masterKeyCas, ttl); } else { status = CBObjSet(masterKey, "master", masterKeyCas, ttl); }

if (status == CBSTATUS_SUCCESS) { for (i = 0; i < retries; i++) { status = CBObjGet(buf, &cas, masterKey, NOLOCK); if (status >= 0) { return cas; } } CBObjDeleteCas(masterKey, cas); return CBSTATUS_FAILURE; } return CBSTATUS_FAILURE;}

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco ConfidentialDiscovery Service

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco ConfidentialDiscovery Service

Used to discover endpoints for specific services or the total set of nodes in the clusterSupports basic load balancing and health check Often provided by Consul, Eureka, DNS, etc

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco ConfidentialAdvertise

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential

appInstance12016-10-24T12:23:42Z172.31.31.15:80

appInstance22016-10-24T12:23:41Z172.17.126.2:80

Example

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco ConfidentialDiscovery

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco ConfidentialDiscoveryCouchbaseApp2 Service InstanceApp2 Service InstanceApp2 Service InstanceApp1 Service InstanceAdvertise foo, instance ip addressLookup foo, choose instanceSend request to address of selected instance

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco ConfidentialShared Queues

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco ConfidentialShared Queues

Create shared queues that are polled by set of nodes Typically provided by HornetQ, RabbitMQ, etc

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco ConfidentialShared Queue Add

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco ConfidentialShared Queue Read

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco ConfidentialTransactions

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco ConfidentialTransactions

Create a generic globally shared transaction system with rollback Typically provided by HornetQ, RabbitMQ, etc

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco ConfidentialTransactionsApp1 Service InstanceIncoming requestApp2 Service InstanceApp2 Service InstanceApp1 Service InstanceApp1 Service InstanceLB

Service requestw/callback URLService requestw/callback URLCallbackCallback

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco ConfidentialIf transaction failed or timed out12Create Transaction

Transaction State Record w/state=active and time=currentTimeTransaction Log Record124Close Transaction

Delete Transaction State RecordDelete Transaction Log123RollbackEither synchronously with failure or discovered through query of transaction state recordsPull transaction logIterate through transaction log in reverseUndo each activity123TransactionsUpdate Transaction state record with state=active and time=currentTimeAppend Activity to Transaction Log Record12Execute Activity

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential

# 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential