Stay organized with collections Save and categorize content based on your preferences.
When starting with a legacy, monolithic application, you must find parts that can be carved off and moved to separate microservices. Often, a well-structured monolithic app will have very natural divisions, and a service class will already function as an interface to a layer of data storage and business logic. Such classes are the ideal place to connect the client calls to the microservice.
Separating functionality in a monolithic appYou could take a couple approaches for how you separate your app:
You might need to refactor your code to remove unnatural dependencies. We recommend that you perform refactoring within your legacy code and deploy it to production before attempting to separate the app into separate services.
Common areas for microservices include the following:
After a set of classes has been identified as a candidate to become a microservice, the next steps include:
app.yaml
).Data migration on a live application can be tricky and highly dependent on your situation. Often, to facilitate roll-forward and rollback, you will need to write code that populates both the old and new Cloud Datastore entities, possibly by using a temporary API on the microservice, and then write code that migrates the existing set of data, for example as a MapReduce. This process will usually involve some amount of temporary code and redundant data. Depending on the specifics of your situation, you may also need to execute a catch-up data migration after you release. Be careful not to overwrite newer data with older data.
While this seems like a lot of work, it's a common occurrence and is important to allow for rolling forward and rolling back in the event that the cutover to the new microservice does not succeed. You can remove your temporary code and delete the data from the old storage location only after you have verified that everything is migrated correctly and everything is operating as expected. Be sure to make backups along the way.
What's nextExcept as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["When transitioning from a monolithic application to microservices, identify and separate logical business units, naturally isolated code, or parts that require different scaling configurations."],["Refactor legacy code within the monolithic application and deploy those changes before extracting it into microservices to ensure a smoother transition."],["Common microservice candidates include user information, authorization, preferences, notifications, media, and task queue workers."],["Migrating to microservices involves leaving original code operational, creating new code repositories, formulating a separate application, deploying, testing, migrating data, and updating the legacy app to use the new microservice."],["Data migration for live applications often requires temporarily populating both old and new data stores to facilitate rollback, along with potential catch-up migrations, and ensuring backups are made during the transition."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4