Skip to content

Instantly share code, notes, and snippets.

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

@odrotbohm
odrotbohm / LambdaTypeDetectionSample.java
Last active January 28, 2023 09:54
Lambda type detection sample
public class LambdaTypeDetectionSample {
public static void main(String[] args) {
Function<Integer, String> lambdaFunction = i -> i.toString();
Function<Integer, String> oldschoolFunction = new Function<Integer, String>() {
public String apply(Integer t) {
return t.toString();
}
@dgageot
dgageot / Types.java
Created June 22, 2013 08:57
Oops, a Lambda tends to forget what's its type.
public class Types {
interface SMI<T> {
T get(T value);
}
public static void main(String[] args) {
SMI<String> inner = new SMI<String>() {
@Override
public String get(String param) {
@ideiudicibus
ideiudicibus / Beanutils.java
Created May 10, 2011 14:17
Merge two java beans useful when discovering differences
class Beanutils{
//merge two bean by discovering differences
private <M> void merge(M target, M destination) throws Exception {
BeanInfo beanInfo = Introspector.getBeanInfo(target.getClass());
// Iterate over all the attributes
for (PropertyDescriptor descriptor : beanInfo.getPropertyDescriptors()) {
// Only copy writable attributes
if (descriptor.getWriteMethod() != null) {