Top Banner
Dependency Management at Netflix Dependency management in a vast microservice landscape
21

Dependency Management at Netflix

Aug 15, 2015

Download

Software

Jon Schneider
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Dependency Management at Netflix

Dependency Management at Netflix

Dependency management in a vast microservice landscape

Page 2: Dependency Management at Netflix

Thin Services, Fat Clients

Page 3: Dependency Management at Netflix

Freedom and Responsibility

Responsible people thrive on freedom and are worthy of

freedom

Page 4: Dependency Management at Netflix

The Binary Dependency Choice

In principle provides the most freedom of action per team

Each team selects a build tool that matches their style

Page 5: Dependency Management at Netflix

Version SkewHow many versions am I

behind the latest available version?

Skew leads to runtime execution paths that were not

unit tested!

Page 6: Dependency Management at Netflix

StabilityBuild repeatability

Don't make me change until I'm ready!

Page 7: Dependency Management at Netflix

Nebula Dependency LockingCaptures results of dependency resolution now

so the same results can be reused later./gradlew generateLock./gradlew -PdependencyLock.useGeneratedLock=true test./gradlew saveLock commitLock

Page 8: Dependency Management at Netflix

Nebula Dependency LockingTo force every project in a multimodule project to

agree on dependency versions:./gradlew generateGlobalLock./gradlew -PdependencyLock.useGeneratedLock=true test./gradlew saveGlobalLock

Page 9: Dependency Management at Netflix

Avoidance

Page 10: Dependency Management at Netflix

Astrid

Page 11: Dependency Management at Netflix

AdepthubUses a version compatibility matrix to calculate a

known valid solution

Page 12: Dependency Management at Netflix

ModularizationShading involves package relocating dependencies

makes them globally uniqueRuntime modularization like OSGi and JBoss Modules are too constraining for us, work

well in some contexts

Page 13: Dependency Management at Netflix

Gradle Shadow PluginRequires action on the part of the dependency

producershadowJar { dependencies { include(dependency('com.google.guava:guava:18.0')) } relocate 'com.google', 'shaded.com.google'}

(roughly equivalent to the Maven Shade Plugin)

Page 14: Dependency Management at Netflix

Gradle Shadow Pluginpublic class NameAgeClient { Multimap<String, Integer> agesByName = HashMultimap.create();

public void addAll(Multimap<String, Integer> agesByName) { this.agesByName.putAll(agesByName); }

public Integer maxAge(String name) { return agesByName.get(name).stream().max(Integer::max).orElse(0); }}

Page 15: Dependency Management at Netflix

Gradle Shadow PluginShaded transitive dependencies are leaked to

dependency consumer@Test public void demonstrateUnshadedSeam() { shaded.com.google.common.collect.Multimap<String, Integer> nameAges = HashMultimap.create(); nameAges.put("jon", 10);

NameAgeClient client = new NameAgeClient(); client.addAll(nameAges);

assertThat(client.maxAge("jon"), equalTo(10));}

Page 16: Dependency Management at Netflix

Project NemoA seam exists at the points

where your project interacts with the public API of its first

order dependenciesThe goal is for this seam to

always refer to only your first-order dependencies

Page 17: Dependency Management at Netflix

Project NemoJust-in-time shading on the dependency

consumer side

Page 18: Dependency Management at Netflix

Project Nemorepositories { maven { url 'https://nemo.netflix.com' }}

dependencies { // appending _module causes JIT shading compile 'commons-configuration:commons-configuration_module:1.10'}

Page 19: Dependency Management at Netflix

Project NemoShaded artifacts are generated on the fly and

differentiated by SHA1

Page 20: Dependency Management at Netflix

Project NemoShaded transitive dependencies are no longer

leaked@Testpublic void demonstrateUnshadedSeam() { Multimap<String, Integer> nameAges = HashMultimap.create(); nameAges.put("jon", 10);

NameAgeClient client = new NameAgeClient(); client.addAll(nameAges);

assertThat(client.maxAge("jon"), equalTo(10));}

Page 21: Dependency Management at Netflix

Thanks!— we are hiring