45
Endurance International Group Getting Along with Your DBOps Team SLC DevOpsDays @nickdemaster

DevOpsDays SLC - Getting Along With Your DBOps Team

Embed Size (px)

Citation preview

Page 1: DevOpsDays SLC - Getting Along With Your DBOps Team

Endurance International Group

Getting Along with Your DBOps TeamSLC DevOpsDays@nickdemaster

Page 2: DevOpsDays SLC - Getting Along With Your DBOps Team

Why do we care?

Page 3: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

Why do we care?

Your data is super important!

Page 4: DevOpsDays SLC - Getting Along With Your DBOps Team

What does the DB Ops team care about?(and how does that apply to dev)

Page 5: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

• Atomicity

ACID

Page 6: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

ACID

• Atomicity• Atomicity requires that each transaction be "all or nothing": if one part of the transaction fails,

then the entire transaction fails, and the database state is left unchanged. An atomic system must guarantee atomicity in each and every situation, including power failures, errors, and crashes. To the outside world, a committed transaction appears (by its effects on the database) to be indivisible ("atomic"), and an aborted transaction does not happen.

Page 7: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

ACID

DevOps Translation:Each code deployment involving a database must be successful and be progressive, not regressive.In the event of a failure in the code deployment, the rollback must be transparent to the user.

• Atomicity• Atomicity requires that each transaction be "all or nothing": if one part of the transaction fails,

then the entire transaction fails, and the database state is left unchanged. An atomic system must guarantee atomicity in each and every situation, including power failures, errors, and crashes. To the outside world, a committed transaction appears (by its effects on the database) to be indivisible ("atomic"), and an aborted transaction does not happen.

Page 8: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

ACID

• Atomicity• Consistency

Page 9: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

• Consistency• The consistency property ensures that any transaction will bring the database from one valid

state to another. Any data written to the database must be valid according to all defined rules, including constraints, cascades, triggers, and any combination thereof. This does not guarantee correctness of the transaction in all ways the application programmer might have wanted (that is the responsibility of application-level code) but merely that any programming errors cannot result in the violation of any defined rules.

ACID

Page 10: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

• Consistency• The consistency property ensures that any transaction will bring the database from one valid

state to another. Any data written to the database must be valid according to all defined rules, including constraints, cascades, triggers, and any combination thereof. This does not guarantee correctness of the transaction in all ways the application programmer might have wanted (that is the responsibility of application-level code) but merely that any programming errors cannot result in the violation of any defined rules.

DevOps Translation:Understand the underlying data you are changing with each code deploy. Make sure that the datastructures you use or change are consistent with the ones currently in place. Keep data types for similardata the same. i.e. If you use database datestamps, don’t switch over to unix timestamps, unless part of a larger initiative.

ACID

Page 11: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

• Atomicity• Consistency• Isolation

ACID

Page 12: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

ACID

• Isolation• The isolation property ensures that the concurrent execution of transactions results in a system

state that would be obtained if transactions were executed serially, i.e., one after the other. Providing isolation is the main goal of concurrency control. Depending on the concurrency control method (i.e., if it uses strict - as opposed to relaxed - serializability), the effects of an incomplete transaction might not even be visible to another transaction.

Page 13: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

DevOps Translation:When doing code deploys, always be on the same page with the way the data is going to bechanged with each deploy. This is most pertinent if you have multiple projects or initiatives going onthat use the same database model. i.e. If you need a column for X and someone else needs the samecolumn for Y, be sure that you don’t crush someone else’s (or your own) changes with an out of order alter/CRUD action.

ACID

• Isolation• The isolation property ensures that the concurrent execution of transactions results in a system

state that would be obtained if transactions were executed serially, i.e., one after the other. Providing isolation is the main goal of concurrency control. Depending on the concurrency control method (i.e., if it uses strict - as opposed to relaxed - serializability), the effects of an incomplete transaction might not even be visible to another transaction.

Page 14: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

• Atomicity• Consistency• Isolation• Durability

ACID

Page 15: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

• Durability• The durability property ensures that once a transaction has been committed, it will remain

so, even in the event of power loss, crashes, or errors. In a relational database, for instance, once a group of SQL statements execute, the results need to be stored permanently (even if the database crashes immediately thereafter). To defend against power loss, transactions (or their effects) must be recorded in a non-volatile memory.

ACID

Page 16: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

DevOps Translation:Understand the mechanics of the durability property of the database. If you are not using a truly ACIDdatabase, you may have to program in checks to assure the data is stored and retrievable correctly –even in the event of a connection or system failure.

ACID

• Durability• The durability property ensures that once a transaction has been committed, it will remain

so, even in the event of power loss, crashes, or errors. In a relational database, for instance, once a group of SQL statements execute, the results need to be stored permanently (even if the database crashes immediately thereafter). To defend against power loss, transactions (or their effects) must be recorded in a non-volatile memory.

Page 17: DevOpsDays SLC - Getting Along With Your DBOps Team

In Practice – Schema

Page 18: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

In Practice – Database Schema

• Know your data! (love your data)

Page 19: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

In Practice – Database Schema

• Know your data! (love your data)• If your database uses them, Explicit Primary Keys

Page 20: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

In Practice – Database Schema

• Know your data! (love your data)• If your database uses them, Explicit Primary Keys• Correctly sized data fields

Page 21: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

In Practice – Database Schema

• Know your data! (love your data)• If your database uses them, Explicit Primary Keys• Correctly sized data fields• Be able to forecast growth patterns

Page 22: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

In Practice – Database Schema

• Know your data! (love your data)• If your database uses them, Explicit Primary Keys• Correctly sized data fields• Be able to reasonably forecast growth• ConSistentNaming Conventions

Page 23: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

In Practice – Database Schema

• Know your data! (love your data)• If your database uses them, Explicit Primary Keys• Correctly sized data fields• Be able to reasonably forecast growth• ConSistentNaming Conventions• Understand storage conventions of the database engine

(i.e. ACID vs eventual consistency)

Page 24: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

• Know your data! (love your data)• If your database uses them, Explicit Primary Keys• Correctly sized data fields• Be able to reasonably forecast growth• ConSistentNaming Conventions• Understand storage conventions of the database engine

(i.e. ACID vs eventual consistency)• Bonus: example queries with explain paths

In Practice – Database Schema

Page 25: DevOpsDays SLC - Getting Along With Your DBOps Team

In Practice – DBA

Page 26: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

In Practice – DBA

• Continuous deployment of code, have a system/agreement in place

Page 27: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

In Practice – DBA

• Continuous deployment of code, have a system/agreement in place• Audit/Change Management (and if possible roll-forward, roll back)

Page 28: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

In Practice – DBA

• Continuous deployment of code, have a system/agreement in place• Audit/Change Management (and if possible roll-forward, roll back)• Data Migrations plans – cause and effect analysis (application/system)

Page 29: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

In Practice – DBA

• Continuous deployment of code, have a system/agreement in place• Audit/Change Management (and if possible roll-forward, roll back)• Data Migrations plans – cause and effect analysis (application/system)• Rapid development infrastructure (development > staging > production)

Page 30: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

• Continuous deployment of code, have a system/agreement in place• Audit/Change Management (and if possible roll-forward, roll back)• Data Migrations plans – cause and effect analysis (application/system)• Rapid development infrastructure (development > staging > production)• Backups and restores – TEST OFTEN

In Practice – DBA

Page 31: DevOpsDays SLC - Getting Along With Your DBOps Team

Getting Along with your DB Ops Team

Page 32: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

Getting Along with your DB Ops Team

• Buy into the same goals

Page 33: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

Getting Along with your DB Ops Team

• Buy into the same goals• Communicate early and often

Page 34: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

Getting Along with your DB Ops Team

• Buy into the same goals• Communicate early and often• Be ready to compromise

Page 35: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

Getting Along with your DB Ops Team

• Buy into the same goals• Communicate early and often• Be ready to compromise• Be able to define stakeholders for each data release

Page 36: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

Getting Along with your DB Ops Team

• Buy into the same goals• Communicate early and often• Be ready to compromise• Be able to define stakeholders for each data release• Be accountable (bonus: be on pager duty)

Page 37: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

• Buy into the same goals• Communicate early and often• Be ready to compromise• Be able to define stakeholders for each data release• Be accountable (bonus: be on pager duty)• TEAM

Getting Along with your DB Ops Team

Page 38: DevOpsDays SLC - Getting Along With Your DBOps Team

I am the DB Ops team (and the dev team.. and the ops team… and the printer person...)

Page 39: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

• Explain plans

Troubleshooting tips

Page 40: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

• Explain plans• Mongo: db.collection.find().explain()

Troubleshooting tips

Page 41: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

• Explain plans• Mongo: db.collection.find().explain()• MySQL/Postgres: EXPLAIN select ...

Troubleshooting tips

Page 42: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

Troubleshooting tips

• Explain plans• Monitor Monitor Monitor (alert alert alert)

Page 43: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

Troubleshooting tips

• Explain plans• Monitor Monitor Monitor (alert alert alert)• Practice your deploys on a staging environment

Page 44: DevOpsDays SLC - Getting Along With Your DBOps Team

@nickdemaster #slcdevopsdays

• Explain plans• Monitor Monitor Monitor (alert alert alert)• Practice your deploys on a staging environment• Automation is key!

Troubleshooting tips

Page 45: DevOpsDays SLC - Getting Along With Your DBOps Team

Endurance International Group

Getting Along with Your DBOps TeamSLC DevOpsDays

@nickdemaster