差别
这里会显示出您选择的修订版和当前版本之间的差别。
| 两侧同时换到之前的修订记录 前一修订版 后一修订版 | 前一修订版 | ||
| public:it:misc [2020/12/29 09:54] – [Latency Numbers Every Programmer Should Know] oakfire | public:it:misc [2021/09/09 14:23] (当前版本) – oakfire | ||
|---|---|---|---|
| 行 1: | 行 1: | ||
| ====== 杂项 ====== | ====== 杂项 ====== | ||
| - | |||
| - | ===== Generate RSA key ===== | ||
| - | <code bash> | ||
| - | # 生成 RSA 私钥(传统格式的) | ||
| - | openssl genrsa -out rsa_private_key.pem 1024 | ||
| - | |||
| - | # 生成 RSA 公钥 | ||
| - | openssl rsa -in rsa_private_key.pem -pubout -out rsa_public_key.pem | ||
| - | |||
| - | # 将传统格式的私钥转换成 PKCS#8 格式的 | ||
| - | openssl pkcs8 -topk8 -inform PEM -in rsa_private_key.pem -outform PEM -nocrypt | ||
| - | </ | ||
| ===== Latency Numbers Every Programmer Should Know ===== | ===== Latency Numbers Every Programmer Should Know ===== | ||
| - | * [[https:// | + | * [[https:// |
| - | + | Latency Comparison Numbers | |
| - | * 2012年的数据: | + | ---------------------------------- |
| - | <file text latency.txt> | + | L1 cache reference |
| - | Latency Comparison Numbers | + | Branch mispredict |
| - | -------------------------- | + | L2 cache reference |
| - | L1 cache reference | + | Mutex lock/ |
| - | Branch mispredict | + | Main memory reference |
| - | L2 cache reference | + | Compress 1K bytes with Zippy 2,000 |
| - | Mutex lock/ | + | Send 2,000 bytes over commodity |
| - | Main memory reference | + | SSD random read 16,000 |
| - | Compress 1K bytes with Zippy 3,000 ns | + | Read 1 MB sequentially from memory |
| - | Send 1K bytes over 1 Gbps network | + | Round trip within same datacenter |
| - | Read 4K randomly from SSD* 150,000 ns 0.15 ms | + | Read 1 MB sequentially from SSD* 49,000 |
| - | Read 1 MB sequentially from memory | + | Disk seek 2, |
| - | Round trip within same datacenter | + | Read 1 MB sequentially from disk 825,000 |
| - | Read 1 MB sequentially from SSD* 1,000,000 ns 1 ms 4X memory | + | Send packet CA-> |
| - | Disk seek 10, | + | |
| - | Read 1 MB sequentially from disk | + | |
| - | Send packet CA-> | + | |
| Notes | Notes | ||
| ----- | ----- | ||
| - | 1 ns = 10-9 seconds | + | 1 ns = 10^-9 seconds |
| - | 1 second | + | 1 us = 10^-6 seconds = 1,000 ns |
| - | 1 ms = 10-3 seconds | + | 1 ms = 10^-3 seconds |
| - | 1 second | + | </ |
| - | * Assuming | + | |
| - | + | | |
| + | Latency Comparison Numbers (~2012) | ||
| + | ---------------------------------- | ||
| + | L1 cache reference | ||
| + | Branch mispredict | ||
| + | L2 cache reference | ||
| + | Mutex lock/ | ||
| + | Main memory reference | ||
| + | Compress 1K bytes with Zippy | ||
| + | Send 1K bytes over 1 Gbps network | ||
| + | Read 4K randomly from SSD* | ||
| + | Read 1 MB sequentially from memory | ||
| + | Round trip within same datacenter | ||
| + | Read 1 MB sequentially from SSD* | ||
| + | Disk seek | ||
| + | Read 1 MB sequentially from disk 20, | ||
| + | Send packet CA-> | ||
| + | |||
| + | Notes | ||
| + | ----- | ||
| + | 1 ns = 10^-9 seconds | ||
| + | 1 us = 10^-6 seconds = 1,000 ns | ||
| + | 1 ms = 10^-3 seconds = 1,000 us = 1,000,000 ns | ||
| Credit | Credit | ||
| ------ | ------ | ||
| - | By Jeff Dean: http:// | + | By Jeff Dean: |
| Originally by Peter Norvig: http:// | Originally by Peter Norvig: http:// | ||
| - | + | ||
| Contributions | Contributions | ||
| ------------- | ------------- | ||
| - | Some updates from: https:// | + | 'Humanized' comparison: |
| - | Great 'humanized' comparison | + | |
| Visual comparison chart: http:// | Visual comparison chart: http:// | ||
| - | Nice animated presentation of the data: http:// | ||
| </ | </ | ||