Migrating a live system to a microservice architecture: Meet backend tech lead Vijayender #WeMakeMercari
Mercari has grown to become Japan’s largest marketplace app, where anyone can buy and sell. However, our journey does not end there. To fulfill our goal of creating a “global marketplace”, we have welcomed talents from all over the world to Mercari’s Tokyo office—around 40 countries and counting.
In the #WeMakeMercari series, we would like to introduce you to some of the members in the company. This time, we would like to introduce one of the tech leads of the Mercari JP Backend Team, Vijayender. As a tech lead for the team, Vijayender serves as a technical reference for his team and is one of the core engineers working on Mercari’s shift to a microservice architecture.
ーWhy did you decide to move to Japan and join Mercari?
I was looking for an international opportunity whilst I was in university but I wasn’t particularly set on Japan. I learnt that Tokyo is a safe, clean, and not to mention global city through a Japanese company that visited my university and ended up joining them as a new graduate.
Last year in 2018, when Mercari was about to reach its IPO, there was hype about its fast and phenomenal growth, and there was a lot of eye catching news about the company surrounding me. At that time Mercari was Japan’s first ever unicorn and number one in the C2C marketplace category.
I ended up researching about the company online and felt that the culture at Mercari is very open and forward-looking which is pretty different from what is considered the norm in a Japanese company. But more importantly, I felt that Mercari would allow me to work on a technically challenging project that would allow me to use my skill sets. Throughout the interview process, I could tell that Mercari was interested in not just my coding skills but how I apply my skills sets to incorporate to problem solving.
Shifting a live feature from a monolithic to microservices architecture
Mercari JP Backend team tech lead, Vijayender Joshi
ーCan you tell me more about the technically challenging project you mentioned above?
Currently, one of the main objectives for the Mercari backend team is to migrate all of our systems from a monolithic architecture in PHP to a microservices architecture in Golang. This also involves migrating our current databases from a traditional datacenter to Google Cloud Platform.
This shift from a monolithic to microservice architecture is a very technically challenging project because we must be able to live migrate, which means we must migrate our application and databases with zero downtime. This brings a host of challenges like realtime database sync and traffic migration. In live migration, the traffic is switched in small percentage from the old system to the new one. As a user you get the same seamless user experience even though the data and application just moved over 800 kms (from Hokkaido to Tokyo).
ーWhat is one of the most memorable projects you have worked on so far?
In one of my most recent projects, I migrated a system called the “draft feature”. This feature is for users selling items on Mercari. When users are in a hurry and don’t want to list the item on Mercari right away, this feature allows them to save it as a draft instead. Just like how you can save an email as a draft instead of sending it right away. The project was to migrate all the APIs from the PHP monolith to a Golang microservice and also migrate the database from our datacenter to GCP.
As I mentioned earlier, microservice migration is a really complicated affair even though it may not sound like one. Our development is divided into three phases: design, implementation and QA. In the design phase we first make a Design Doc for our proposed microservice. The design doc should state all important information such as the role and scope of the service, APIs, the database and migration plans. For this we had to investigate our existing PHP codebase and document the behavior of the current APIs.
The API implementation was pretty straightforward but the database part was really tricky. We had to figure out how to sync the databases in real time, this was especially challenging considering that old database was using MySQL while the new one would be GCP Datastore.
Life at Tokyo and Mercari
ーHow would you describe life in Tokyo?
Like any country, you need to be mentally prepared that you are moving to a country with a different culture be aside from you. However, in general, to me Tokyo is a great place to live. The city is clean and safe, the people are amazing and even with my limited Japanese language skills, I can manage to live comfortably here.
ーHow would you describe the culture at Mercari?
I feel this company has very few barriers or silos. Even though we have grown really big and quite fast, we have a lot of opportunities to meet new people such as club activities and quarterly parties as well as English and Japanese lunches. If you make sure to make use of all these opportunities the company provides, you are able to interact with people you don’t do work with on a daily basis. This helps breaks down the barriers that developed when you just work with one team every day. And it gives you more of a feeling that you are part of one big community.
We’re hiring! Related job postings
Vijayender Joshi is currently the Tech Lead for one of the Mercari JP Backend Teams. He has been working in Tokyo for almost 3 years as a full stack developer and loves hiking, programming and video games.