The document discusses building a new service-oriented architecture at Allegro Group. It describes initial efforts to break the monolithic Allegro application into microservices using technologies like Spring, Jetty, Swagger, ZooKeeper and Docker. It outlines an approach of developing independent, discoverable services that communicate over REST APIs. The document also discusses improving the new architecture over time with features like authentication, monitoring, patching support and simplified annotations. Overall, it proposes building on modern tools and standards to scale Allegro's application and engage developers in the process.
2. #33rdDegree @DebskiChris
Allegro The New World Improvement WIIFY
Agenda
The Allegro Situation
How to build a new World?
The way to improve
What’s in it for you?
3. Allegro The New World Improvement WIIFY
#33rdDegree @DebskiChris
The Allegro Situation
18. #33rdDegree @DebskiChris
Allegro The New World Improvement WIIFY
The first approach
Service
Auto deployable
Auto monitored
Auto scalable
Auto healable
Auto discoverable
… and many more features
19. Allegro The New World Improvement WIIFY
#33rdDegree @DebskiChris
How to build a new World?
30. #33rdDegree @DebskiChris
Allegro The New World Improvement WIIFY
And make them discoverable
Offer
User
Discovery
ZooKeeper
Get User
Get offer for user
31. #33rdDegree @DebskiChris
Allegro The New World Improvement WIIFY
Multiple API versions
Content negotiation
@Path("/users")
@Consumes(”application/json”)
@Produces(”application/json”)
public class UsersEndpoint {
// [...]
@GET
public UserCollectionResponse findAllUsers() {
//[...]
}
}
32. #33rdDegree @DebskiChris
Allegro The New World Improvement WIIFY
Multiple API versions
Content negotiation
@Path("/users")
@Consumes(”application/vnd.allegro.user.v1+json”)
@Produces(”application/vnd.allegro.user.v1+json”)
public class UsersEndpoint {
// [...]
@GET
public UserCollectionResponse findAllUsers() {
//[...]
}
}
curl --dump-header - -H ”Accept: application/vnd.allegro.user.v1+json"
-X GET http://localhost:8080/users
33. #33rdDegree @DebskiChris
Allegro The New World Improvement WIIFY
Multiple API versions
Content negotiation
@Path("/users")
@Consumes(”application/vnd.allegro.user.v1+json”)
@Produces(”application/vnd.allegro.user.v1+json”)
public class UsersEndpoint {
// [...]
@GET
@Produces(“application/vnd.allegro.user.v2+json”)
public UserCollectionResponse findAllUsers() {
//[...]
}
}
curl --dump-header - -H ”Accept: application/vnd.allegro.user.v2+json"
-X GET http://localhost:8080/users
39. #33rdDegree @DebskiChris
Allegro The New World Improvement WIIFY
Lower startup time
Immutable Images Service
Undertow
Zip file
Server
Immutable image
41. #33rdDegree @DebskiChris
Allegro The New World Improvement WIIFY
How to configure it?
Service ZooKeeper
java –jar service.jar –Dzookeeper.address=zookeper.service
42. #33rdDegree @DebskiChris
Allegro The New World Improvement WIIFY
How to configure it?
Service ZooKeeper
java –jar service.jar –Dzookeeper.address=zookeper.service –Denvironment=prod
prod.properties
43. #33rdDegree @DebskiChris
Allegro The New World Improvement WIIFY
How to configure it?
Service ZooKeeper
java –jar service.jar –Dzookeeper.address=zookeper.service –Denvironment=prod
-Dservice.name=testService
prod.properties
44. Allegro The New World Improvement WIIFY
#33rdDegree @DebskiChris
Tests
46. #33rdDegree @DebskiChris
Allegro The New World Improvement WIIFY
Integration tests
Test without mocks
Run from IDE
public class UsersIntegrationTest {
private static Map<String, String> overrideConfiguration = Maps.newHashMap();
static { overrideConfiguration.put("property.name", "This was overwritten value"); }
@ClassRule
public static final RestServiceStarted DEPLOYED_SERVICE =
new RestServiceStarted(overrideConfiguration);
private WebTarget getUsersResourceWebTarget() {
return DEPLOYED_SERVICE.getWebTarget().path("users");
}
}
47. Allegro The New World Improvement WIIFY
#33rdDegree @DebskiChris
Monitoring
58. Allegro The New World Improvement WIIFY
#33rdDegree @DebskiChris
What’s in it for you?
59. #33rdDegree @DebskiChris
Allegro The New World Improvement WIIFY
Use the latest tools
GradleW in CI ENV and parent POM issues.
Don’t do DDOS yourself and your partners.
60. #33rdDegree @DebskiChris
Allegro The New World Improvement WIIFY
Change is the only constant
Deployment tools
Service API provider
Dependency injection
HTTP Server
Cargo
Docker
Ecosystem
Swagger Jersey addon
Guice Spring
Jetty Undertow
61. #33rdDegree @DebskiChris
Allegro The New World Improvement WIIFY
Focus on right metrics
How to have 100% code coverage?
public class UserMediaType {
public static final String V1_JSON =
"application/vnd.allegro.user.v1+json”
public static final String V2_JSON =
"application/vnd.allegro.user.v2+json”
}
62. #33rdDegree @DebskiChris
Allegro The New World Improvement WIIFY
Focus on right metrics
import org.junit.Test;
import static net.trajano…
public class MediaTypesTest {
@Test
public void mediaTypesShouldBeValidUtilityClasses()
throws Throwable {
assertUtilityClassWellDefined(UserMediaType.class);
}
}
You don’t need 100% code coverage!
63. #33rdDegree @DebskiChris
Allegro The New World Improvement WIIFY
Tools also lie
Metrics tend to lie
Configuration:
default PHP metrics
Tested file:
4535 CLOC
Imperative programming
66. #33rdDegree @DebskiChris
Allegro The New World Improvement WIIFY
Learn to REST
REST is not so obvious
/api/bi/XYZ123/1
/recommendations/1/items
/offer/100?output=ESI/JSON
67. #33rdDegree @DebskiChris
Allegro The New World Improvement WIIFY
Community
Involve all developers in building the Bootstrap.
Or they will build their own tools.
Łukasz Drumiński Mateusz Gajewski
@wendigo
68. Allegro The New World Improvement WIIFY
#33rdDegree @DebskiChris
Q & A