Experiences using CouchDB inside Microsoft's Azure team

32
CouchDB at Microsoft We’re running it in Azure, and so can you

description

Co-presented with Will Perry (@willpe). Real-world experiences using CouchDB inside Microsoft, and also how to get started with CouchDB on Microsoft Azure.

Transcript of Experiences using CouchDB inside Microsoft's Azure team

Page 1: Experiences using CouchDB inside Microsoft's Azure team

CouchDB at MicrosoftWe’re running it in Azure, and so can you

Page 2: Experiences using CouchDB inside Microsoft's Azure team

Will Perry @willpe

[email protected]

Windows Azure Group

Brian Benz @bbenz

[email protected]

Microsoft Open Tech

Page 3: Experiences using CouchDB inside Microsoft's Azure team

An app we’ve built

How we built it. Some tips and tricks

Share some experience on helping folks get used to non-relational databases.

Open Source at Microsoft

Running CouchDB in Windows Azure

Page 4: Experiences using CouchDB inside Microsoft's Azure team

the app.

Daylight – a test automation system for the cloud

Stores metadata about every revision of every test case in our product

About 10k tests updated about 6 times a day

Stores details of test runs and results

About 5k results stored 6 times a day

100% in the cloud

Page 5: Experiences using CouchDB inside Microsoft's Azure team
Page 6: Experiences using CouchDB inside Microsoft's Azure team

the database.

Must haves:

Scale to millions/billions of documents

Fairly loose schema

Not a single point of failure

Multiple indexes – really fast access to docs

Nice to haves:

Web friendly

Aggregate oriented

Http Interface

Easily partitionable

SQL TABLE COUCH

Page 7: Experiences using CouchDB inside Microsoft's Azure team

CouchDB was the most natural fit for the data we had

and the app we were building

…and the Apache 2.0 license helped keep the lawyers happy

Page 8: Experiences using CouchDB inside Microsoft's Azure team

the architecture.

Multi-node deployment with application server and couch db running on each node and replicating across the deployment

Node 0

Load Balancer

Node 1 Node 2

VHD VHD VHD

Page 9: Experiences using CouchDB inside Microsoft's Azure team

time-partitioned data.

Mar-2013 Feb-2013Apr-2013 Jan-2013

Test data becomes exponentially less useful over time. Part of our scale strategy is deleting old data in a ‘sliding-window’ fashion.

Page 10: Experiences using CouchDB inside Microsoft's Azure team

semi-static typing.

[JsonProperty("attributes")]public JObject Attributes { get; set; }

[JsonProperty("full_name", Required = Required.Always)] public string FullName { get; set; }

[JsonProperty("priority")]public int Priority { get; set; }

Strong typing when we want it, loose typing when we don’t

Page 11: Experiences using CouchDB inside Microsoft's Azure team

http.

using (var httpClient = new HttpClient(couchBaseUri)){

return await httpClient.GetAsync(resultId);}

We didn’t feel the need to use a client library, and just extended the built-in http stack to encapsulate some of our conventions

Page 12: Experiences using CouchDB inside Microsoft's Azure team

design documents.

In the source tree

Used a directory tree to map to the json tree

Compile into a json document at start-up

Compare to existing design doc and overwrite if different

Page 13: Experiences using CouchDB inside Microsoft's Azure team

culture shock.

Map/Reduce != T-SQL

Help out SQL junkies by talking in terms of the index.

Page 14: Experiences using CouchDB inside Microsoft's Azure team

experience.

We really like CouchDB. It’s been really reliable, simple to manage and reduced our implementation costs.

Sometimes indexing can slow us down and there’s a reasonable ramp-up required for new devs on the project.

Overall, we’re confident we made the right choice.

Page 15: Experiences using CouchDB inside Microsoft's Azure team

Wholly owned subsidiary of Microsoft

To advance Microsoft’s investment in openness

Interoperability

Open source

Open standards

Page 16: Experiences using CouchDB inside Microsoft's Azure team

Windows Azure: What It Is

Flexible

Page 17: Experiences using CouchDB inside Microsoft's Azure team

Windows Azure

Virtual Machines

Windows Server 2008 R2

Windows Server 2012

OpenSUSE 12.1

CentOS 6.2

Ubuntu 12.04

SUSE Linux Enterprise Server SP2

Page 18: Experiences using CouchDB inside Microsoft's Azure team

VM Depothttp://vmdepot.msopentech.com

Call to action: Developers can use VM Depot to reach new audiences!

Page 19: Experiences using CouchDB inside Microsoft's Azure team

Windows Azure: What It Is

Page 20: Experiences using CouchDB inside Microsoft's Azure team
Page 21: Experiences using CouchDB inside Microsoft's Azure team

Deployment Complexity

OperationalResponsibility Flexibility OS Security

IaaS Some High HighLinux or Windows

Custom

PaaS Some Low HighWindows only

Built-in

SaaS Low/noneNone

Limited N/A Built-in

What’s the Difference?

Page 22: Experiences using CouchDB inside Microsoft's Azure team

Virtual Machine Sizes

VM SizeCPU Cores

MemoryBandwidth (Mbps)

# Data Disks

Extra Small

Shared 768 MB 5 1

Small 1 1.75 GB 100 2

Medium 2 3.5 GB 200 4

Large 4 7 GB 400 8

Extra Large

8 14 GB 800 16

Page 23: Experiences using CouchDB inside Microsoft's Azure team

Supported Web Frameworks

Page 24: Experiences using CouchDB inside Microsoft's Azure team

Supported Publishing Methods

Page 25: Experiences using CouchDB inside Microsoft's Azure team

Windows Azure Developer Center

Open-source SDKs forpopular programminglanguages, to get youup and running quickly

Choice of popular IDEssuch as Visual Studioand Eclipse

Consistent REST protocols and APIs across Windows Azure services

http://www.windowsazure.com/en-us/develop/overview/

.NET driver

Node.js driver

Java driver

PHP driver

Python driver

Driver download page

Page 26: Experiences using CouchDB inside Microsoft's Azure team
Page 27: Experiences using CouchDB inside Microsoft's Azure team
Page 28: Experiences using CouchDB inside Microsoft's Azure team

azure topic verb options

Command Line Syntax Overview

prompt>

accountaccount locationaccount affinity-groupvmvm diskvm endpointvm imageserviceservice certsiteconfig

downloadimportlistshowdeletestartrestartshutdowncapturecreateattachdetachbrowseset

usernamepassworddns-prefixvm-namelb-porttarget-image-namesource-pathdisk-image-namesize-in-gbthumbprintvalue-v-vv

Page 29: Experiences using CouchDB inside Microsoft's Azure team

Example: Provisioning a Cluster

azure vm create couchsd "OpenLogic__OpenLogic-CentOS-62-20120531-en-us-30GB.vhd" username password -l "West US" -e

azure vm create couchsd "OpenLogic__OpenLogic-CentOS-62-20120531-en-us-30GB.vhd" username password -l "West US" -e 23 -c

azure vm create couchsd "OpenLogic__OpenLogic-CentOS-62-20120531-en-us-30GB.vhd" username password -l "West US" -e 24 -c

azure vm endpoint create couchsd 27017 27017

azure vm endpoint create couchsd-2 27018 27018

azure vm endpoint create couchsd-3 27019 27019

Page 31: Experiences using CouchDB inside Microsoft's Azure team

Getting Started

http://www.windowsazure.com/en-us/pricing/free-trial/

http://channel9.msdn.com/Events/WindowsAzureConf/2012/KEY01

Sign up for a free trial

Learn about the latest features

Page 32: Experiences using CouchDB inside Microsoft's Azure team

Will Perry @willpe

[email protected]

Windows Azure Group

Brian Benz @bbenz

[email protected]

Microsoft Open Tech