At the 2017 Tencent Global Partner Conference that just concluded, Tencent released its AI opening panorama for the first time, and carried out the open layout of Tencent’s whole product line centering on the AI main line. No matter the strategic planning of AI, or the opening and implementation of AI technologies such as machine learning, computer vision and speech recognition, they are all supported by the cloud, just like AI is a rocket and cloud computing is a booster.
In the hot cloud computing market, Tencent Cloud has always been relatively low profile, but this does not prevent it from deeply developing its own technology, and carry forward the advantages of technology. Recent tencent cloud with geek state science and technology in Beijing held a titled “decoding tencent cloud” software architecture and application of the technique salon, six technical experts from tencent clouds and zhihu, introduced tencent cloud in a small program, video business and no cloud server functions, middleware, and other fields of technical reserves, and share their insights. This article sorted out some wonderful dry goods content, interested students can click to read the original text to download the full version of the speech PPT.
The technical support behind real-time audio and video explosive APP
Huang Bin, product director of Tencent cloud video business, gave an opening speech. His theme was “How to quickly build a popular APP based on real-time audio and video capabilities”. Everyone is certainly familiar with network broadcast and audio and video applications. Whether it is the war of thousands of broadcast in 2016 or video + based on commercial live broadcast, network broadcast and video have gone from entertainment to vertical field.
However, real-time audio and video technology requirements are actually very high, from the point of view of foundation and architecture to do push flow; To do the basic platform; To carry out audio and video coding and decoding; To carry out various formats of terminal adaptation; To do long protocol support; To do beauty clap, beauty dynamic effect, reward and other functions; In addition, users now open an anchor’s room, or enter an e-commerce room, have not accepted the delay, seconds is the industry standard.
In response, Huang bin said: “Tencent has been doing audio and video business for more than 10 years, our team is based on QQ extension, now we are doing Tencent cloud audio and video business, we gradually open this business to provide complete solutions.”
In terms of live video and short video, Tencent Cloud opens its capabilities through various SDK interfaces. In this respect, Tencent Cloud provides two sets of solutions. The first set of solutions is standardized, integrating the host end/source site, streaming media processing, CDN and viewing end.
And a solution is provided by various video call QQ audio and video before, in fact this is a non standard solutions, it is tencent proprietary protocol based on RTP protocol transformation, the private agreement after tencent validation, it delayed, stability, the bidirectional interaction to ensure that the best seconds delay performance, it is better than standard streaming protocol; Moreover, it shares a lot of resources with QQ’s global deployment, so it has an advantage in resource security. Its most notable feature is the support for interactive link with the MAC.
From the perspective of application, Huang Bin also carried out a detailed explanation. Mobile live streaming can be divided into two types: light weight or fast integrated small live streaming and free live streaming. Real-time game audio and Video (TMG) is called mobile game in Tencent, but in fact the main function is to make real-time audio and video; Short videos also require a lot of capabilities, such as pinching, adding motion effects, making filters, dynamic beauty, adding sound captions, quick sharing, and a lot of background optimization. Of course, there are different scenarios for short videos, such as travel and social networking, and each scenario provides a different focus on technical support.
For the security of live broadcast, AI capabilities should be used to identify images and sounds and complete the work of live broadcast yellow authentication and large screen viewing. In this regard, Tencent’s Youtu engine can perform intelligent yellow authentication for thousands of rooms in real time, which can complete 90% of the recognition work, and the concurrent retrieval time of millions is less than 150ms. Huang added that green screen technology, segmentation technology based on background pre-learning and VGG Net-based human recognition network can be easily implemented by introducing AI into live broadcasting.
In terms of the penetration of live broadcasting into vertical fields, whether e-commerce, finance, online education or entertainment, real-time audio and video capabilities can be found to be applied in different scenarios, which also echoes huang Bin’s opinion at the beginning of his speech.
In addition, H5 two-way audio and video (T-H5) is also a product of Tencent Cloud based on QQ’s accumulation of audio and video calling technology in more than ten years, combined with Tencent’s browsing service TBS WebRTC capability and Tencent real-time audio and video SDK, to provide customers with high-quality video calling capability on multiple platforms. End users only need to initiate a video request through the H5 page in mobile QQ/ wechat /QQ browser and all other APPS connected to TBS to easily access the real-time video service of the enterprise.
At the end of the speech, Huang Bin demonstrated a small program and real-time audio and video technology integration of a business scenario, can be in the small program ability to do two-way or even multi-directional real-time audio and video. Take auto insurance claims as an example, open the loss assessment mini program, through real-time audio and video can be completed online damage assessment.
None Server cloud function product SCF details
Serverless architecture has attracted wide attention this year. Tencent Cloud also launched the serverless cloud function product SCF. Huang Wenjun, product manager of Tencent CLOUD SCF serverless cloud function, shared the theme of “Realizing data Streaming Analysis with Cloud Function combined with Message Service”.
Huang Wenjun’s sharing was introduced from the anti-crawler scene, which is a very common scene, centering on UA detection, IP detection, proxy IP identification and blocking, which are also several courses of crawler development. In the third process, what do we do if the user uses a proxy IP? At this time we can not find one by one IP, it is necessary to use the power of the code to find the IP for the corresponding blockade. How do I find the IP? The most common is the traditional way of storing and then analyzing, is there a more time-sensitive way? Huang wenjun introduced that Tencent cloud provides a streaming way to conduct analysis.
Streaming data analysis is characterized by the fact that there are many data sources to be analyzed, such as the data collected by the Internet of Things terminal, the geographical location reported by the mobile phone, the changes in the stock market, and users’ clicks on website links, etc. At the same time, these data are constantly generated. In this data, in fact, are continuously reported, are very small single record, but in the presence of a large number of sources, small single record can also form a very high concurrency. The reason for using streaming analysis is to speed up the analysis speed and analyze the data within a certain period of time immediately, otherwise the significance of expired data will not be so great.
How do we solve requirements with streaming analysis? We put the storage and analysis in parallel, or as long as the analysis process does not store the procedure, the storage still does a summary, the summary may just be a cache, with the cache to do the latest collection and collection, after collection immediately analysis, get the output result. This can be achieved by using Tencent’s messaging service and cloud functions on the cloud. In fact, both products can be called serverless architectures.
Serverless is a hot concept this year. It is structurally divided into two parts. One is the back-end as a service, which is the object storage, CDB cloud database or message queue products that many people are using. The other is function as service, namely SCF serverless cloud function product launched by Tencent Cloud.
Why is it called a service free architecture? It can be used when it is opened. After it is opened and configured, it can be connected and used through API or SDK. There is no need to configure the server, which is handed over to the cloud for operation and management. For developers, the only thing they care about is code. Another characteristic of the serverless architecture is that it is event-driven, triggered by events.
Specifically, the goal of SCF serverless cloud function product is hosting computing. Users do not need to care about the number of computing resources in the background, how much CPU should be allocated, how much memory, but only care about uploading code, hosting the code to the platform, and configuring triggers to complete the operation.
For the log analysis demo, Huang wenjun said, “We can use this architecture to do streaming analysis. The logs are aggregated into the same topic in Kafka, and then kafka is used to trigger cloud function analysis. The message pull method is used here. A batch is pulled at a time, and the analysis results can still be cached in another Topic in Kafka and then aggregated again for subsequent processing.
The message service is the service provided by Tencent Cloud. It is currently divided into three types, including CMQ message queue — providing queue mode and topic mode; Ckakfa — compatible with open source Kafka, providing queue mode; MQ for IOT – Supports MQQT access and provides a topic subscription model.
The way SCF is used, or how it works, is that users initially create a function on the platform, upload code or code packages or libraries, and configure a trigger. If you have enough events, all the functions run as parallel instances, and this scaling is actually done automatically on the platform, without the user caring how many instances I have to take or how many resources I have to allocate to control those instances.
For example, Huang wenjun said, “SCF requires stateless, so how to process and summarize the results of analysis? In fact, Redis is used for caching and counting. I used another function, and I used a timer trigger, like every 5 minutes I went to Redis to see which IP in the list had exceeded the threshold, like in 5 minutes it had accessed 2,000 times, I thought it was crawler, SO I pulled it out and generated a block list.”
Furthermore, Huang wenjun also presented a Demo, which is also a streaming process, which is biased towards IoT device collection and uses IoT MQ products to receive messages from all IoT devices. Create two functions that do different things. The first one is to subscribe to the log, upload the log every Tuesday, receive the log and make a summary, put it in Kafka, or put it directly in Topic, and record it as a file. Another way is to subscribe to a different topic, which is an alarm. When an alarm occurs on a certain device, it will trigger the following operations, such as sending an email or SMS, using this function to deal with it. In fact, the key point of cloud function is the trigger. Cloud function itself is a function of connecting these cloud products and getting through various cloud products to form some complete solutions. Huang wenjun said: “At present, the cloud function is in the public beta period, which is free. After the official operation, each account has a free quota.”
There are three key stages of zhihu containerization
The next speaker is a Tencent cloud user, wang Lu, senior engineer of Zhihu Container Platform. He will share the road of Zhihu Container.
According to the introduction, Zhihu started to be fully containerized in 2015. Up to now, 99% of its business is on containers, and the basic components are also on containers. When asked why zhihu wanted to be containerized, Wang lu said, “At that time, Zhihu used pure physical machines, which had high cost and low resource utilization. The first virtualization scheme we choose is virtual machine, namely OpenStack, but the cost of human maintenance is still relatively high. In addition, the capacity expansion efficiency of VMS is low. After that, we launched microservices. Microservices and containers are almost in the same line, so we finally decided to use containers. The project was named Bay, which means bay.”
“At that time, we were faced with three choices: MESOS, K8S and Swarm. At that time, WE chose MesOS. This is the overall architecture of our first phase, which is a PaaS architecture. At this stage only the physical machines of the business are containerized, not the base components.”
After the completion of the initial stage of the first stage, the platform mainly supports the following functions: rolling upgrade, Canary release, complete CI/CD integration, support for almost all services (ten thousand level container), second level automatic expansion (10->100 35s).
If the first phase solved the problem of business containerization, the second phase also encountered the problem of basic components in the process, which is the problem of Kafka cluster management. In the beginning Kafka managed a large single cluster. There were two typical problems. One was a sudden increase in topic traffic, which caused the whole cluster to fail. The second is load imbalance. In this case, it is very expensive to maintain two Kafka clusters instead of one, requiring three machines for the smallest cluster. Zhihu’s solution was to containerize Kafka Broker by defining finer granularity scheduling units and more efficient cluster management tools. Finally, Zhihu chose to containerize Kafka Broker. The efficient cluster management tool was Kubernetes, which used local components of Kubernetes for local disks. Disk it into this container. The ideal is to run three Kafka clusters on three machines, with each Kafka broker occupying a separate disk to form three clusters.
As the business grows, some container groups grow larger, and some container groups can contain more than 1,000 containers, which may be very slow to come online once. The Bay ended up using only one mouth, and its speed was limited; The second is the inability to roll back quickly; The third is the lack of operational tools; Finally, mesOS has low community activity.
Based on these deficiencies, Zhihu considered rebuilding the BAY system with the goal of improving the deployment speed. The first is how to solve the problem of rapid deployment rollback, the first method is to distinguish deployment and release; As for rollback, after the business deploys the new code, the old code is not destroyed, and the container exists but is not serviced externally.
The overall structure of the third stage is that the new BAY system is also placed on Kubernetes, which is equivalent to the coexistence of the two systems. How is the framework of the new Bay system distributed and deployed? According to Wang, Zhihu sends requests through the API of the new Bay system. At present, about 1/3 of zhihu’s business has been migrated to the new Bay system. Rapid deployment can be completed within 3 seconds, and the operating efficiency of the platform has been improved.
At the end of the speech, Wang Lu said that the follow-up development of the system involves the expansion of Tencent’s public cloud. In the case of insufficient resources, Zhihu plans to distribute containers to clusters and expand the capacity of virtual machines provided by Tencent’s public cloud to the public cloud to make a level-1 backup.
MQ best practices in areas such as big data and IOT
Message-oriented middleware has a series of functions such as low coupling, reliable delivery, broadcast, flow control and final consistency, so it has become the core means of asynchronous RPC communication in distributed systems. There are many mainstream messaging middleware on the market today, such as the old RabbitMQ, hot Kafka and so on. Tencent messaging middleware has created a highly reliable and consistent distributed messaging middleware CMQ based on RAFT algorithm for the company’s financial business, which has been tested by numerous wechat red envelopes and Webank messages during the Spring Festival for many times.
Huang Yu, architect of Tencent cloud middleware, shared how Tencent messaging middleware achieves high reliability, high elasticity, high performance and strong consistency from the technical perspective, and the best practices in different application fields.
Big data MQ-CKafka technology practice
According to Huang, the application scenarios of MQ for big data mainly include log collection, log analysis, Spark Streaming feature extraction and EMR. Tencent Cloud has made a series of optimization practices in log collection of big data:
- The original log collection method uses the log +ES+COS bucket storage method. This method has a problem, that is, during the storage of the log information captured by ES to the COS system, any storage system is a path. In this case, the memory consumption is huge, and it is difficult to support the differentiated storage of logs accessed by a large number of users.
- To solve this problem, Tencent cloud’s optimization plan is to store all messages in the message middleware, such as Kafka system, which decouples messages through Kafka, and then sends log information to COS bucket and ES system respectively to relieve the pressure of resource pool. The following figure is the comparison between the original plan and the improved plan of Tencent cloud big data log collection:
Here, Kafka in addition to blanking fill and decoupling, but also plays a role in data distribution and aggregation, such as data needs to be analyzed on multiple platforms, you can use Kafka to distribute decoupled messages to different platforms for log analysis; On the other hand, based on the usage of Kafka, the same data from different platforms can be aggregated on one server to perform Spark Streaming feature extraction. These are typical scenarios of big data applications.
Based on the typical application of Kafka, Tencent Cloud according to its own business needs to develop a CKafka (Cloud Kafka) architecture, compared with the open source Kafka system, CKafka has distributed, high scalability, high throughput and other performance, at the same time, It is 100% compatible with the Apache Kafka API (0.9 and 0.10), and developers can use all Kafka features directly without deployment. Ckafka’s small package performance is 5 times that of open source when there are four partitions at the same time (750MB/s VS158MB/s). So how can the Ckafka system achieve such high throughput? Here is the architecture diagram of Ckafka:
First of all, Ckafka abandons Java mechanism and adopts operating system-level page caching. Second, it uses an optimized system mechanism (as shown above) to improve IO features. At the same time, in the horizontal aspect, Ckafka adopts a rule similar to multiplication, shards multiple messages, and synchronously processes each shard message. As a result, the Ckafka system’s processing speed for massive messages is basically exponentially increased.
Analysis of Tencent MQ technology for IOT
In addition to the application in big data, MQ also has rich applications in IoT. For example, MQTT is the mainstream protocol in the field of Internet of Things and mobile Internet, and is widely used in the Internet of vehicles, smart home, live interaction, financial payment, IM instant messaging and other scenarios. Especially in IOT scenarios requiring low power consumption, limited network throughput, and poor network quality, it has unique advantages.
Tencent Cloud has developed an MQTT protocol compatible IOT MQ product based on MQTT according to its own application characteristics. The following figure shows the IoT MQ application architecture. The device side publishes the message to Tencent Cloud’s Topic and then forwards the message to the receiver. What is the systemic effect of this? For example, if a user uses electricity, water or any household equipment, the service provider will develop a relevant wechat mini program, so that users can easily see the amount of electricity or water used on your phone.
According to Huang yu, in addition to compatible WITH MQTT 3.1.1 protocol, and any SDK supporting the protocol, IoT MQ based on Tencent’s own CMQ architecture, according to the scale of business flexibility, transparent to the upper layer, at the same time, CMQ-MQTT provides Tencent cloud platform a complete set of operation and maintenance services, O&m services include resource application, message query, and alarm monitoring, realizing unified O&M and saving a lot of O&M costs.
Next “Applets, Containers, SCF, Live Acceleration… The Most Comprehensive Cloud Architecture Technology Revealed (PART 2)”