3. 3
Takayuki Nishiyama [Taka,Nisshy]
25 years old
4 years engineer
Long・Experienced Short・Interest・Learning
4. 4
Topic
• What is System Event Notification Service(SENS)?
• Requirement of SENS
• How to realize load distribution of SENS
• Summary
5. 5
What is System Event Notification Service(SENS)?
Shop
Time
Purchase !!
Purchase !!
Purchase !!
Nothing!!
Please wait
Cancel !!
A EC Site
Y EC Site
6. 6
What is System Event Notification Service(SENS)?
Shopper
Basket
SENS
Inventory
Management
System
7. 7
Requirement of SENS
• Real-time
• Ensure Order Sync
•Avoid Duplication
• Keep High Performance
8. 8
How to realize load distribution of SENS
•Asynchronous
•Separate each function
9. 9
Architecture of SENS
Took Ave 207msec???
Too Slow !!
Java Remote Interface
DB
API Layer Batch Layer
• Asynchronous
• Separate each function
14. 14
Currently Issue
• Batch Performance is needed
• Slow Down due to Out Side Cause
• Error Handling
• Operation
• Monitoring
15. 15
Impression
• Service Level = Load Balancing
• Architecture is Great and Very Important.
• Visualization is attracting.
• Thinking is very fun
Notas do Editor
I’m going to introduce SENS and architecture of SENS.
In addition, I’ll introduce one case of solution.
Before that time, I’m going to introduce myself.
This is me.My name is.. ,and 25 years old, and 4 years engineer.Everyone call me Taka, Nissy and Kasuga.I’m from Wakayama which is famous for mandarins.Below is my hobbies, and above is my interest.On hobby, I play the piano, play volleyball, swim and run on a holiday.On interest, recently, I’m interested in Load Balancing, full-text search and machine learning technology.
So this is today’s topic.At first, may be you don’t know about SENS, so I talk about what SENS is.And then I describe requirement and architecture of SENS.Finally, I’ll talk my impression about currently SENS.
At beginning, what is SENS? SENS is System Event Notification Service
Marchants do business on various EC Site. Before Release SENS, we send mail to notify order information to merchant on15min.
This situation occur 2 problems. First, shoppers can’t get item due to notification lag nevertheless they buy the item earlier than other shoppers
Seconde, it is difficult for merchant side to manage inventory by only sending mail. Especially, The bigger Merchant is, the more feel it.
So we’d like to realize to cooperate with Marchant inventory management System. When shopper put into basket and purchase items of the shop, basket calls SENS with order information and send to Inventory Management system of out side.In advance, developer of Management System shared where SENS send order information,And we linked shop and it to SENS.
SENS help to develop Marchant Inventory Management System and sync on real-time. No delay.
As a result, Shopper is reasonable when they can’t buy item. In addition, Machant side can manage inventory easier than before.
So SENS has to support many requirement.
One. We have to notify order information as soon as possible.
Two We have to ensure information’s order and notify all order information completely.
Three If we send same information, it makes merchants confused. So we avoid notifying duplication.
Four In addition to our service’s perfomance, Internal service uses our service. So our service is needed to keeping high response performance.
Today, I focus on How to keep high performance on SENS.
This is First architecture.
Mainly, SENS consists of 3 Layer,
API Layer which has Apache/Tomcat,
Database which is mysql
and Batch Layer. Which is made from Spring Batch
The first, API Layer accepts request from Basket and register information into DB.
On the other hands, on Batch Layer, notification VM is waiting at all time. So API calls these VM on RMI after registering data.
Finally, notication VM send order information to out-side management system’s server.
One day after Super Sale , as you know.
Basket Side said,
“SENS is too SLOW !! More Fast !! We want you to improve it to Ave 60 msec than less!!”
Because Basket calls not only SENS but also many other api.
We thought.
Cause of slow response is covering to register to DB and call VM on API Layer.
So, Let’s separate request accepter and registration, make asynchronous and loose coupling.
How …..
Oh let’s use Apache Camel !!
Apache Camel is strong to Connection Setting and Routing.
Apache Camel uses URIs to work directl with any kind of Transport or messaging model.
If we can separate Registration function from API Layer, we can build up each function.
If you want to know detail of apache camel, please visit official Apache Camel Site..
If you feel hard to understand English, there is Japan Apache Camel User too.
This is Result. This is Current architecture.
We created Camel server between API and Database.
API only check which order information is OK or NG, and to send Camel Layer on asynchronous.
Camel Layer register data and call notification VM.
This improvement make response time from ave 204 to ave 40msec.
This improvement costs about 5 days.
Next I describe Camel’s good point.
Camel code is easy to understand message route.
As you can see, define endpoint and difine route, from and to. only it !
Connection setting is only xml too.
In addition, it is easy to understand Camel’s class.
Implement Camel’s processor, and getHedaer with key when you want get message.
When you send next processer, set header and property.
It is simple.
But.. Next I describe bad point
Welcome to xml hell.
This is real our setting file.
Wow too long…
Detail.. Xml Total line is 213.
Process flow line is ocupied almost of setting file.
It is good that we can set detail configulation of connection.
But We have to difine such like parameter.
Blue Sentence is it.
It is difficult to read due to long…
I’d like to improve these bad point in the future.
Last, I talk about current SENS.
On the whole, I think that our selection is good, which is using Apache Camel for loosing coupling.
SENS is running for 3 years, but it has had no big trouble and been stable.
And next. SENS will be expanding to Global Scale.
So, we have to think about load balance and preparing for various situation.
It may occur connection delay, changing data structure, so on.
Finally, It is fun and interesting to think solution and architecture of such as SENS.
If you intersted in SENS, please join us!!