Skip to content

Instantly share code, notes, and snippets.

View bojand's full-sized avatar
💭
I may be slow to respond.

Bojan bojand

💭
I may be slow to respond.
View GitHub Profile
@bojand
bojand / index.md
Last active March 1, 2024 19:32
gRPC and Load Balancing

Just documenting docs, articles, and discussion related to gRPC and load balancing.

https://github.com/grpc/grpc/blob/master/doc/load-balancing.md

Seems gRPC prefers thin client-side load balancing where a client gets a list of connected clients and a load balancing policy from a "load balancer" and then performs client-side load balancing based on the information. However, this could be useful for traditional load banaling approaches in clound deployments.

https://groups.google.com/forum/#!topic/grpc-io/8s7UHY_Q1po

gRPC "works" in AWS. That is, you can run gRPC services on EC2 nodes and have them connect to other nodes, and everything is fine. If you are using AWS for easy access to hardware then all is fine. What doesn't work is ELB (aka CLB), and ALBs. Neither of these support HTTP/2 (h2c) in a way that gRPC needs.

@bojand
bojand / override.go
Created April 4, 2018 12:05
Method override in Go
package main
import (
"fmt"
"strings"
)
type Cap struct {
message string
}
@bojand
bojand / index.md
Last active May 16, 2022 19:32
gRPC benchmarks Go & Node.js
@bojand
bojand / main.rs
Created July 17, 2020 01:54
Rust Struct Lifetime
#![allow(unused)]
use std::fmt;
#[derive(Copy, Clone)]
pub struct Type<'a> {
mime_type: &'a str,
}
impl<'a> Type<'a> {
@bojand
bojand / throttle.go
Created March 25, 2018 01:03
goroutine throttling
package main
import (
"log"
"sync"
"time"
)
const tasksPerSecond = 1
@bojand
bojand / buffer_iface.go
Last active April 7, 2019 17:18
Go interfaces
package main
import (
"bytes"
"fmt"
"io"
"reflect"
)
func do(w io.Writer) {
@bojand
bojand / code.go
Created January 30, 2019 21:22
gRPC Reflection Client
func TestRunReflection(t *testing.T) {
var cc *grpc.ClientConn
var opts []grpc.DialOption
var mtd *desc.MethodDescriptor
opts = append(opts, grpc.WithInsecure())
dialCtx := context.Background()
cc, err = grpc.DialContext(dialCtx, "host", opts...)
if err != nil {
@bojand
bojand / main.go
Created November 21, 2018 16:54
Functional options
package main
import (
"fmt"
"time"
)
type Config struct {
Secure bool
Timeout time.Duration
@bojand
bojand / patterns.md
Created September 11, 2018 13:31
Go concurrent patterns
@bojand
bojand / embedded_receiver.go
Last active August 24, 2018 17:36
Go structs
package main
import (
"fmt"
)
type E struct{}
func (e *E) foo() {
fmt.Println("E.foo()")