Seata初试采坑

背景:

公司采用dubbo的分布式服务,现在业务上遇到了分布式事物的问题,和同事讨论改过几个分布式的开源框架,最终采用了seata,seata的性能相对比较客观,但是回滚情境下,性能下降特别厉害,这个与seata的网络IO和数据IO多次交互相关。具体各种分布式事物管理的开源框架推荐一篇文章可以参考:若干分布式事务框架”与“我的偏见”( 测试/分析),此处我们部署搭建是最新的1.1.0版本。

采坑之路:

1.Seata Server搭建部署

服务端搭建,可以直接从seata开源社区下载最新版本,下载的文件可以直接在服务器解压部署,自行修改配置文件自己的环境参数主要是下图的file.conf和register.conf
在这里插入图片描述
register.conf 主要配置如下:

registry {
  # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
  # 注册中心采用的zk
  type = "zk"

  nacos {
    serverAddr = "localhost"
    namespace = ""
    cluster = "default"
  }
  eureka {
    serviceUrl = "http://localhost:8761/eureka"
    application = "default"
    weight = "1"
  }
  redis {
    serverAddr = "localhost:6379"
    db = "0"
  }
  zk {
    cluster = "default"
    # 集群配置采用,隔开
    serverAddr = "127.0.0.1:2181,127.0.0.1:2183,127.0.0.1:2183"
    session.timeout = 6000
    connect.timeout = 2000
  }
  consul {
    cluster = "default"
    serverAddr = "127.0.0.1:8500"
  }
  etcd3 {
    cluster = "default"
    serverAddr = "http://localhost:2379"
  }
  sofa {
    serverAddr = "127.0.0.1:9603"
    application = "default"
    region = "DEFAULT_ZONE"
    datacenter = "DefaultDataCenter"
    cluster = "default"
    group = "SEATA_GROUP"
    addressWaitTime = "3000"
  }
  file {
    name = "file.conf"
  }
}

config {
  # file、nacos 、apollo、zk、consul、etcd3
  # 这边的配置没有对接配置中心所以采用file的方式配置,这边配置之后会自动读取file文件的配置
  type = "file" 

  nacos {
    serverAddr = "localhost"
    namespace = ""
    group = "SEATA_GROUP"
  }
  consul {
    serverAddr = "127.0.0.1:8500"
  }
  apollo {
    app.id = "seata-server"
    apollo.meta = "http://192.168.1.204:8801"
    namespace = "application"
  }
  zk {
    serverAddr = "127.0.0.1:2181"
    session.timeout = 6000
    connect.timeout = 2000
  }
  etcd3 {
    serverAddr = "http://localhost:2379"
  }
  file {
    name = "file.conf"
  }
}

file.conf 配置如下

store {
  ## store mode: file、db
  # 存储我们设置为db模式
  mode = "db"

  ## file store property
  file {
    ## store location dir
    dir = "sessionStore"
    # branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions
    maxBranchSessionSize = 16384
    # globe session size , if exceeded throws exceptions
    maxGlobalSessionSize = 512
    # file buffer size , if exceeded allocate new buffer
    fileWriteBufferCacheSize = 16384
    # when recover batch read size
    sessionReloadReadSize = 1
  • 3
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 8
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值