Closed NattapongSiri closed 4 years ago
Fixed by implement native single gateway deployed by using built-in docker so it has low startup time.
Now, wlt_translate
first spin up time down from 8120ms
to 4310ms
where on Cloud function side down from 7690ms
to 3560ms
.
We can further shave response time down by remove create WA session task out as unified gateway will create one if it is missing anyway. To achieve this, we need to modify the gateway to return session_id as well as the message itself. Thereafter, we modify client to get session_id and update it on each message send/recieve.
Implemented in 1608f68
This reduce first response time range from <1s to 10s depending on IBM Cloud workload at the moment.
It may take about 40 seconds for bot to response. After investigation, this happen because our service rely on various components running on different platform at different location.
Analysis
After fresh deploy of express client on Heroku
The first message took about following response time:
Immediate second message
Comparing to immediate second message where it doesn't need to create another WA session
Potential fix
Merge 3 translate-message sub-process into one
merge input-translate, send-message, and output-translate into single function.
Pros
This shall reduce communication overhead and spinning up time for each function.
Cons
Harder to maintain ??