Mpush系列[3]之限流过程分析1
2019-07-29 10:26:43 0 举报
mpush 的限流分析
作者其他创作
大纲/内容
RollingNumber
A4: 提供统计结果
0
long windowStart;
Bucket3
value
BucketCircularArray
time;
time
THREAD_POOL_REJECTED4
Bucket
......
CumulativeSum
long get(Event type)
FAILURE1
1LongAdder
ListState
3LongAdder
LongAdder[] adderForCounterType;
ListState addBucket(Bucket b);
Bucket0
tail
4LongAdder
AtomicReferenceArray<Bucket> data;
Bucket5
addBucket(Bucket lastBucket)
4
timeInMilliseconds
Bucket2
Eventordinal()
...LongAdder
0LongAdder
addLast();
cumulativeSum
5LongAdder
head
Mpush系列之限流过程分析(2)
long getCumulativeSum(type)
Bucket6
dataLength=8;1个定值. // 8为举例说明
Bucket1
..
SUCCESS0
SHORT_CIRCUITED3
1
2LongAdder
这里用到了设计模式之不变模式span style=\"font-size: inherit;\
A1: 通过 tail 找到当前的桶
Bucket4
∑
3
COLLAPSER_BATCHN
NLongAdder
LongAdder getAdder(Event type)
BucketCircularArray buckets;
current
7
2
numberOfBuckets
Bucket7
TIMEOUT2
numBuckets = dataLength -1;
6
SEMAPHORE_REJECTED5
size =(tail + dataLength - head) % dataLength
5
LongAdder getAdder(Event type);
AtomicReference<ListState> state;
return adderForCounterType[type.ordinal()]
0 条评论
下一页