Dependency Management at Netflix


The Presentation inside:

Slide 0

Dependency Management at Netflix Dependency management in a vast microservice landscape


Slide 1

Thin Services, Fat Clients


Slide 2

Freedom and Responsibility Responsible people thrive on freedom and are worthy of freedom


Slide 3

The Binary Dependency Choice In principle provides the most freedom of action per team Each team selects a build tool that matches their style


Slide 4

Version Skew How many versions am I behind the latest available version? Skew leads to runtime execution paths that were not unit tested!


Slide 5

Stability Build repeatability Don't make me change until I'm ready!


Slide 6

Nebula Dependency Locking Captures results of dependency resolution now so the same results can be reused later ./gradlew generateLock ./gradlew -PdependencyLock.useGeneratedLock=true test ./gradlew saveLock commitLock


Slide 7

Nebula Dependency Locking To force every project in a multimodule project to agree on dependency versions: ./gradlew generateGlobalLock ./gradlew -PdependencyLock.useGeneratedLock=true test ./gradlew saveGlobalLock


Slide 8

Avoidance


Slide 9

Astrid


Slide 10

Adepthub Uses a version compatibility matrix to calculate a known valid solution


Slide 11

Modularization Shading involves package relocating dependencies makes them globally unique Runtime modularization like OSGi and JBoss Modules are too constraining for us, work well in some contexts


Slide 12

Gradle Shadow Plugin Requires action on the part of the dependency producer shadowJar { dependencies { include(dependency('com.google.guava:guava:18.0')) } relocate 'com.google', 'shaded.com.google' } (roughly equivalent to the Maven Shade Plugin)


Slide 13

Gradle Shadow Plugin public 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); }


Slide 14

Gradle Shadow Plugin Shaded 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));


Slide 15

Project Nemo A seam exists at the points where your project interacts with the public API of its first order dependencies The goal is for this seam to always refer to only your firstorder dependencies


Slide 16

Project Nemo Just-in-time shading on the dependency consumer side


Slide 17

Project Nemo repositories { maven { url 'https://nemo.netflix.com' } } dependencies { // appending _module causes JIT shading compile 'commons-configuration:commons-configuration_module:1.10' }


Slide 18

Project Nemo Shaded artifacts are generated on the fly and differentiated by SHA1


Slide 19

Project Nemo Shaded transitive dependencies are no longer leaked @Test public 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));


Slide 20

Thanks! — we are hiring


Slide 21


×

HTML:





Ссылка: