Skip to content

Commit 52abb5a

Browse files
committed
Updated with new structure
1 parent 100c551 commit 52abb5a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

source/_posts/2015-01-12-rewrites-and-big-bang-deploys.markdown

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ author: Andy Wardle
99

1010
Developers love to rewrite code:
1111
* It's always more exciting to work on Greenfield development.
12-
* The code you are working on was written by someone else and it is poorly written, hard to understand, or worse * case, it doesn’t do what the business requires.
12+
* The code you are working on was written by someone else and it is poorly written, hard to understand, or worse case, it doesn’t do what the business requires.
1313
* There are always shiny new things which developers want to use (reactive extensions, event sourcing etc. etc.) and it's not usually feasible to implement these in an existing service
14-
(note: I am not advocating rewriting a service just for sake of some new technology or style).
1514

1615
<!-- more -->
16+
(note: I am not advocating rewriting a service just for sake of some new technology or style).
1717

1818
Most of the time, the business will not let developers spend months rewriting a service on a whim. Why spend a small fortune in developer time refactoring, with no tangible business value added?
1919

@@ -29,17 +29,18 @@ Now that we have a bit of experience in performing these rewrites, we have honed
2929
We have two ways we can combat this to minimise impact to our players:
3030
* Feature Switching
3131
* Side by side running
32-
33-
###Feature Switching
32+
3433
Feature switching is a widely known topic and a lot of information about it is available across the internet. Within this blog post, I want to cover side by side running in a bit more depth, as I feel this has given us huge confidence in knowing how our new services will react when released into Production.
3534

35+
3636
###Side By Side Running
3737
{% img center /images/tee.png 'Request flow using Tee' 'Request flow using Tee' %}
3838

3939
The diagram above shows the flow of traffic. The request Tee is a very small application sitting beside NGINX that takes the incoming request and duplicates it. The main request carries on to the existing service and the response that is returned is sent back upstream as per normal. The duplicated request is then asynchronously sent to the new version of the service, the response back from the new service is logged and then sent to /dev/null. This allows us to test the new service, with real production traffic, without impacting the existing service.
4040

4141
Sitting in front of the new service is a micro service (Mapper). Its job is to take the incoming request, map it to the contract of the new service before sending it to the new service. It then does the same for the response, mapping from new contract to old contract. Having this mapper service in place allows us to switch to the new service without having to update all upstream clients in one go. We can update them as and when the resource is available. Once all upstream clients are updated to communicate directly with the new service, we can delete the mapper service.
4242

43+
4344
###Data Comparison
4445
The next benefit from doing side by side running is we can do data comparison between both services to make sure that data between services match. As the services within our platform all publish messages asynchronously, we created an application which consumes messages from both versions of the service and then compares the data. Any discrepancies are logged, which allows us to then find and resolve the issue.
4546

@@ -48,5 +49,5 @@ We have used this method for our most recent service and it has given us the con
4849
* The new service performs as expected (response times, memory / cpu usage etc)
4950
* We can release the new service with no impact to upstream clients
5051

51-
5252
Going forward, if we ever need to do another service rewrite, we will be using both feature switching and side by side running to give us a high degree of confidence that we won’t negatively impact the gaming experience for our players.
53+

0 commit comments

Comments
 (0)