Skip to content

Instantly share code, notes, and snippets.

@DanielYWoo
DanielYWoo / gist:6c9693fc6bbe3641111a0089cecc4399
Last active August 31, 2022 07:07
k8s memory quota - request and limit
Memory
- Limit:
○ On a ns: used to calculate available resource: avail = limit - used
○ Sum(pod limit) must be less than the ns limit quota
○ Special behavior: On a pod without ns: kill it if exceed
- Request:
○ On a ns: used to control how much can be requested
○ Sum(pod request) must be less than the ns request quota
○ Special behavior: When ns request exists, pod request missing, pod request falls back to pod limit
import redis.clients.jedis.Jedis;
public class RedisBenchmark {
public static void main(String[] args) {
Jedis jedis = new Jedis("127.0.0.1", 6379);
//warm up
for (int i = 0; i < 1000; i++)
jedis.set("a", "1");
@DanielYWoo
DanielYWoo / rbtree.erl
Last active August 29, 2015 14:21 — forked from mjn/rbtree.erl
-module(rbtree).
-export([insert/3, find/2]).
% Node structure: { Key, Value, Color, Smaller, Bigger }
find(_, nil) ->
not_found;
find(Key, { Key, Value, _, _, _ }) ->
{ found, { Key, Value } };