user-generated data in netfortris – connect silicon valley 2017
TRANSCRIPT
• Netfortris provides an integrated phone, chat and text messaging system
• Chat, Team/Group chat, Call, Conference, Call center.
• HUD has the “remote control” – a fairly complex web/mobile app
• Users generate huge volumes of chat and call data Chat and call data (include chat/call event) Peak during work hours
• Need to support different queries for user generated data
Per users, per conversation, per chat/call
• A user’s configuration “state” is shared with all users of that customerUser, conference, extension, device …Support all many different queries.
• Bad user experience Slow response time - over 60 seconds to load page
• User generated data is too big to manipulate efficiently in a single RDBMS instance
Weekly, sometime daily production issues due to data overload Difficult (if not impossible) to partition RDMS
• Difficult to scale as user base grows Customer Support Issues for larger customers
• Move user generated data from RDBMs to Couchbase with Java SDK
• Get auto data partition, HA, Cache• Flexible in data definition, no need schema change when data
model change.• Create two buckets for chat and calls• Create views to query user generated data
• Store user generated data and as much customer/user management data in Couchbase as possible with Go SDK (Go with Couchbase gets superior performance over Java)
• Use N1QL to manipulate data in Couchbase• CREATE INDEX `index_session_id` ON
`chat_messages`(`session_id`) WHERE (`doc_type` = `CM`) USING GSI
• Select `chat_messages`.* from `chat_messages` where sesssion_id = 111
SDK/N1QL Sample
• Define N1QL query statement:• querySettings = gocb.NewN1qlQuery("select `fon_user`.*
from 'fon_user` where owner = ? and ownerType = ? and customerId = ? and clientType = ? and docType = ?")
• Run go to query:
• bucket := this.CbPool.Borrow()qParams := []interface{}{userId, "USER", customerId, clientType,
"settings"}• vResults, err := bucket.ExecuteN1qlQuery(querySettings,
qParams)
o Response time – from over 60 seconds to sub-1 secondo User generated data – from too big to under controlo Weekly production issues – no more!o Scaling issues – no more!o Releases resources to new projects
• Eventually consistency issueo Define the view in separate design doc to reduce indexing
duration.• Return key only by view query instead of full doc.• Use N1QL for new projects.