GithubHelp home page GithubHelp logo

my-rpc's Introduction

My-RPC

简易rpc框架,实现net/rpc并增加协议交换、服务注册与发现、负载均衡、超时处理等特性。

概述

  • 从零实现了 net/rpc 包,具有基本调用功能
  • 支持通过不同的编码格式进行序列化和反序列化
  • 高性能客户端,支持并发和异步请求
  • 支持客户端和服务端的超时处理
  • 具有注册中心,通过心跳机制进行健康检查
  • 具有服务发现功能,支持多种负载均衡算法

遇到的问题

1. Goroutine 泄漏

使用 chan 来通知协程关闭,避免协程泄漏

finish := make(chan struct{})
defer close(finish)

go func() {
    ...
    select {
    case <-finish:
        // avoid goroutine memory leak
        ... your code ...
        return
    ...
}()

2. TCP 沾包

对于 Option,同样采用 gob 编码。

my-rpc's People

Contributors

pjimming 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.