Sharing: mala-video server side improment
Cyril Yu

Agenda

  • How many issues we met?

  • Comparison (before vs after)

  • Challenges

  • Plans

How many issues we met

  • Vod update time cannot be updated when vod information is updated.

  • Cannot use vod image from external url.

  • Cannot choose vod category using drop-down menu.

  • Cannot use bullet screen function.

  • API response time average is more than 600ms.

  • Hard to deploy and setup.

  • Etc..

Comparison

Before After
Cannot sticky or change the sorting of vides. Use the video update time to be the sorting rule.
Hard to assign a category for videos intuitively. (need to input the id of category, doesn't make sense) Implemented drop-down menu to list video categories.
Video bullet screen doesn't work. Implemented a websocket server to handle bullet screen function.
API response time average is not good. (more than 600ms) Refactor APIs using golang, and rewrite  SQL commands, the response average is less than 200ms. (On going)
Hard to deploy and trace codes. Remove useless and old version functions, then dockerize it.
API returns db query result directly, it would be hard to do error handling. Refactor APIs, make it return and object or array, not query result.

Challenges

  • The system architecture is hard to scale. (All function would be scale even though some functions are not necessary needed.)

  • No storage service, it would be hard to manage video or profile images. (store in runner server.)

  • Bad security, there are some known security issues about the db version which we are using, and the framework(maccms) is fade out, too. 

Plans

  • Split frontend and API part, it would be easier to scale up and dockerize. If we care about SEO, could use server side rendering.
  • Implement DB cluster and memory cache function to increase server availability.
  • Upgrade DB version from MySQL 5.6 to MySQL 8.x, change the API language from PHP 5.6 to Golang 1.12.x. (isolate backend and frontend.)
  • Use k8s or docker swarm to management containers, it would help us the scale up services.

Comparison

Before After
It would cost more than half hour to deploy the backend server. It could be deployed in 10 mins.
Database security and query performance is not good enough. Could fixed known security issues, and increase the performance more than 20 percent.

https://severalnines.com/database-blog/mysql-performance-benchmarking-mysql-57-vs-mysql-80
API response time average is about 200ms. API response time could be less than 100ms after refactoring. 
Service scale time would be slow because all function need to be run up. Service scale time would be increased more than 50%.

Sharing: mala-video backend improvement

By Cyril Yu

Sharing: mala-video backend improvement

  • 782