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 / 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 / patterns.md
Created September 11, 2018 13:31
Go concurrent patterns
@bojand
bojand / limit.go
Created July 7, 2018 22:51
go concurrency
package main
import (
"fmt"
"strings"
"time"
)
func upper(input string) string {
fmt.Println("upper " + input)
@bojand
bojand / README.md
Last active June 29, 2018 12:22
Simple WebAssembly fibonacci performance test

Simple, quick performance demo / test comparing JavaScript and WebAssembly. Uses fibonacci (n = 40) with 31 runs.

Convert fib.wat to wasm using wat2wasm tool and download as fib.wasm.

Use Node.js 10.

Run:

node index.js
@bojand
bojand / index.md
Last active May 16, 2022 19:32
gRPC benchmarks Go & Node.js
@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 / throttle.go
Created March 25, 2018 01:03
goroutine throttling
package main
import (
"log"
"sync"
"time"
)
const tasksPerSecond = 1
@bojand
bojand / index.md
Last active June 17, 2025 06:01
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 / driver-service-server.go
Last active August 8, 2017 18:05
Hot R.O.D. driver service fixed
// Copyright (c) 2017 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in