Giter VIP home page Giter VIP logo

go-kratos-study's Introduction

kratos学习项目

  • 为什么包取名叫internal,因为go会对这个包名做禁止引用,保证代码的解耦

  • B站v1的httpServer运行

    • log
    • maxbyte
    • maxconn
      • 注意limiter初始化的位置
    • recover
    • timeout(http层次未作拦截,即无传入timeoutHander,但是传入了Context供其他层判断)
    • trace(zipkin/jaeger)
    • criticality 接口重要性
    • 新增break中间件(接口级别熔断)
    • default标签改写,之前json格式时不生效
    • promethues监控
  • todo

  • grpc功能实现

    • etcd注册
    • p2c负载均衡
    • break
    • log
    • grpcerror
    • metadata
    • 级联timeout
    • trace
  • demo

    • golangci检测
    • admin+gorm(share db架构,运营平台微服务共享db,只是权限不同)
    • service+mysql
    • job+kafka
    • kafka
    • 数据库delete_time 为null的时间处理,自定义时间
    • errgroup
    • runsafe
    • 获取天气的等api的demo,client以及分层设计
    • mysql慢日志,熔断
    • redis慢日志,无熔断(不支持集群)
    • redis的demo,读失败后的写缓存策略(降级后一般读失败不触发回写缓存)。
    • 空缓存保护策略,将空数据缓存,避免请求直接打到db
    • redis分布式锁(架构上尽量规避,性能不高,case多,容易出bug)
    • 基于B站的mysql的redis封装go-zero的cache
    • chan-singleFlight
    • chan-fanout(生产消费模式:这里用作redis回写异步处理)
    • chan-pipeline
    • metadata
    • grpcerror
    • validate
    • 贫血模型
    • csv导出
    • breaker(google sre 熔断器)
    • 多租户 (流量染色)
    • hash-id封装(内部int类型给前端时转化为hash)
    • attrs(mysql字段,bit标识)
    • redis(bitmap大offset处理)
    • 滑动窗口
    • 降级(BFF层做,不在service端做是怕调用者做二级缓存,缓存降级数据,当遇到错误时,可以选择返回空,默认数据或者热门数据:服务端push,内存存储)
  • pkg/errors处理指南

    • 底层包不需要Wrap,直接返回,或者定义sentinel error
    • dao层Wrap,或者其他层第一次定义错误码,也要Wrap
    • 已经wrap的err,避免堆栈信息重复,可使用WtihMessage带信息,不处理可直接return
    • 在最外层 %+v 打印堆栈信息
    • 个人感觉在grpc的client端没必要加日志

go-kratos-study's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.