当前位置: 首页 > news >正文

花都营销型网站情感链接

花都营销型网站,情感链接,天涯论坛,网站做1.安装环境 kafka环境 参考Docker搭建kafka环境-CSDN博客 xk6-kafka环境 ./xk6 build --with github.com/mostafa/xk6-kafkalatest 查看安装情况 2.编写脚本 test_kafka.js // Either import the module object import * as kafka from "k6/x/kafka";// Or in…

1.安装环境

kafka环境

参考Docker搭建kafka环境-CSDN博客

xk6-kafka环境

./xk6 build --with github.com/mostafa/xk6-kafka@latest

查看安装情况

2.编写脚本

test_kafka.js

// Either import the module object
import * as kafka from "k6/x/kafka";// Or individual classes and constants
import {Writer,Reader,Connection,SchemaRegistry,SCHEMA_TYPE_STRING,
} from "k6/x/kafka";// Creates a new Writer object to produce messages to Kafka
const writer = new Writer({// WriterConfig objectbrokers: ["localhost:9092"],topic: "my-topic",
});const reader = new Reader({// ReaderConfig objectbrokers: ["localhost:9092"],topic: "my-topic",
});const connection = new Connection({// ConnectionConfig objectaddress: "localhost:9092",
});const schemaRegistry = new SchemaRegistry();
// Can accept a SchemaRegistryConfig objectif (__VU == 0) {// Create a topic on initialization (before producing messages)connection.createTopic({// TopicConfig objecttopic: "my-topic",});
}export default function () {// Fetch the list of all topicsconst topics = connection.listTopics();console.log(topics); // list of topics// Produces message to Kafkawriter.produce({// ProduceConfig objectmessages: [// Message object(s){key: schemaRegistry.serialize({data: "my-key",schemaType: SCHEMA_TYPE_STRING,}),value: schemaRegistry.serialize({data: "my-value",schemaType: SCHEMA_TYPE_STRING,}),},],});// Consume messages from Kafkalet messages = reader.consume({// ConsumeConfig objectlimit: 10,});// your messagesconsole.log(messages);// You can use checks to verify the contents,// length and other properties of the message(s)// To serialize the data back into a string, you should use// the deserialize method of the Schema Registry client. You// can use it inside a check, as shown in the example scripts.let deserializedValue = schemaRegistry.deserialize({data: messages[0].value,schemaType: SCHEMA_TYPE_STRING,});
}export function teardown(data) {// Delete the topicconnection.deleteTopic("my-topic");// Close all connectionswriter.close();reader.close();connection.close();
}

3.运行测试

运作之前先开启kafka服务,打开终端输入命令

./k6 run test_kafka.js --vus 50 --duration 10s

测试结果

http://www.yidumall.com/news/90370.html

相关文章:

  • 网站开发介绍ppt网页搜索优化
  • 网站如何自己做seoseo培训讲师招聘
  • 安顺做网站的公司app怎么开发出来的
  • wordpress侧边联系方式企业seo排名外包
  • 做网站还有流量么嘉兴seo外包公司
  • 杭州做兼职网站建设高级搜索
  • 荆门网站建设昆山网站建设推广
  • 智能建站系统免费版唐山seo推广公司
  • 上海建设单位工程备案网站房地产估价师考试
  • 信息中心加强网站建设网络营销策略的内容
  • 做网站有er图经典软文广告案例
  • 重庆推广网站排名公司百度官方app下载
  • 门户网站建设方案免费二级域名分发
  • 苏州营销网站建设百度推广怎么推广
  • 网站栏目做树形结构图hao123网址导航
  • 网站建设应该注意哪些原则网站都有哪些
  • 男生学平面设计好就业吗seo辅助优化工具
  • 做网站收藏的网页免费建站的网站有哪些
  • 那个网站的公众后推广做的好高端网站建设哪家便宜
  • 做外贸翻译用那个网站百度云app
  • 长安做网站价格自建站模板
  • 网页设计学校网站泰安网站建设优化
  • 网站网页框架构架图怎么做网站开发教程
  • 手机网站免费生成app百度网盘登录
  • 获取网站全站代码襄阳seo优化排名
  • 个人网站做论坛还是博客好搜索引擎营销的模式有哪些
  • 百度做的网站后台怎么更新百度seo推广价格
  • 菜谱网站开发站长域名查询工具
  • 高性能网站建设在线阅读怎么优化电脑系统
  • 网站编写语言怎么做一个网站