116 Matching Annotations
  1. Feb 2024
  2. Nov 2023
    1. All about Caching: Strategies, Challenges and Optimization

      Caching is a crucial technique in modern #webservices, helping to improve #performance, reduce #latency, and minimize the load on servers and networks. The principle is simple: storing copies of data in a more quickly accessible location to enable faster access to that data. But, as with many technologies, the devil is in the details. In fact, creating a good configuration is very difficult and the smallest mistake can be very detrimental to the performance of our #website.


  3. Sep 2023
  4. Aug 2023
  5. Jul 2023
  6. May 2023
    1. Figured it out. Cache-Control header is required.

      js const headers = { 'Cache-Control': 'public, max-age=604800' }; const request = new Request('https://foobar.com/') const cacheResponse = new Response('bar',{ headers }) const cache = caches.default await cache.put(request, cacheResponse) const response = await cache.match(request);

  7. Mar 2023
    1. <table><tbody><tr><th colspan="4" rowspan="1">Status</th><th colspan="4" rowspan="1">Description</th></tr><tr><td colspan="5" rowspan="1">HIT</td><td colspan="5" rowspan="1">The resource was found in Cloudflare’s cache.</td></tr><tr><td colspan="5" rowspan="1">MISS</td><td colspan="5" rowspan="1">The resource was not found in Cloudflare’s cache and was served from the origin web server.</td></tr><tr><td colspan="5" rowspan="1">NONE/UNKNOWN</td><td colspan="5" rowspan="1">Cloudflare generated a response that denotes the asset is not eligible for caching. This may have happened because:
    2. A Worker generated a response without sending any subrequests. In this case, the response did not come from cache, so the cache status will be none/unknown.
    3. A Worker request made a subrequest (fetch). In this case, the subrequest will be logged with a cache status, while the main request will be logged with none/unknown status (the main request did not hit cache, since Workers sits in front of cache).
    4. A Firewall rule was triggered to block a request. The response will come from the edge network before it hits cache. Since there is no cache status, Cloudflare will log as none/unknown.
    5. A redirect page rule caused the edge network to respond with a redirect to another asset/URL. This redirect response happens before the request reaches cache, so the cache status is none/unknown.
    6. </td></tr><tr><td colspan="5" rowspan="1">EXPIRED</td><td colspan="5" rowspan="1">The resource was found in Cloudflare’s cache but was expired and served from the origin web server.</td></tr><tr><td colspan="5" rowspan="1">STALE</td><td colspan="5" rowspan="1">The resource was served from Cloudflare’s cache but was expired. Cloudflare could not contact the origin to retrieve an updated resource.</td></tr><tr><td colspan="5" rowspan="1">BYPASS</td><td colspan="5" rowspan="1">The origin server instructed Cloudflare to bypass cache via a Cache-Control header set to no-cache,private, or max-age=0 even though Cloudflare originally preferred to cache the asset. BYPASS is returned when enabling Origin Cache-Control. Cloudflare also sets BYPASS when your origin web server sends cookies in the response header.</td></tr><tr><td colspan="5" rowspan="1">REVALIDATED</td><td colspan="5" rowspan="1">The resource is served from Cloudflare’s cache but is stale. The resource was revalidated by either an If-Modified-Since header or an If-None-Match header.</td></tr><tr><td colspan="5" rowspan="1">UPDATING</td><td colspan="5" rowspan="1">The resource was served from Cloudflare’s cache and was expired, but the origin web server is updating the resource. UPDATING is typically only seen for very popular cached resources.</td></tr><tr><td colspan="5" rowspan="1">DYNAMIC</td><td colspan="5" rowspan="1">Cloudflare does not consider the asset eligible to cache and your Cloudflare settings do not explicitly instruct Cloudflare to cache the asset. Instead, the asset was requested from the origin web server. Use Page Rules to implement custom caching options.</td></tr></tbody></table>
  • Feb 2023
  • Nov 2022
    1. The presence of an Age header field implies that the response was not generated or validated by the origin server for this request. However, lack of an Age header field does not imply the origin was contacted, since the response might have been received from an HTTP/1.0 cache that does not implement Age


  • Aug 2022
  • Apr 2022
    1. Repeated references to local variables are good because the compiler cancache them in the register file (temporal locality).. Stride-1 reference patterns are good because caches at all levels of the memoryhierarchy store data as contiguous blocks (spatial locality).

      重复使用 local variable 以及 stride-1 pattern 为什么是 cache-friendly 的?

    2. we suggest adopting a mental model that assumeswrite-back, write-allocate caches.

      write hit 和 write miss 建议采用哪种模式进行思考?

    3. fully associative caches are only appropriate for small caches

      fully associative caches 适合什么场景?

    4. A copy of w is contained in the line if and only if the valid bit is setand the tag in the cache line matches the tag in the address of w.

      如何判断要读取的 w 在 cache line 里面?

    5. The process that a cache goes through of determining whether a request is ahit or a miss and then extracting the requested word consists of three steps: (1) setselection, (2) line matching, and (3) word extraction.

      process 请求内存,有哪三个步骤?

  • Mar 2022
    1. Restrictive placement policies of this kind lead to a type of miss known asa conflict miss, in which the cache is large enough to hold the referenced dataobjects, but because they map to the same cache block, the cache keeps missing.

      如何理解 conflict miss?

    2. When the size of the working set exceedsthe size of the cache, the cache will experience what are known as capacity misses.

      什么是 capacity miss?

    3. For caches high in the memory hierarchy (close tothe CPU) that are implemented in hardware and where speed is at a premium,this policy is usually too expensive to implement because randomly placed blocksare expensive to locate.

      cache 等级高的 memory 为什么不要实现最灵活的 placement policy?

    4. The decision about which block to replace is governed by the cache’s replacementpolicy.

      当 cache misses 发生的时候,需要做什么事情,有哪些方式?

    5. a program needs a particular data object d from level k + 1, it first looksfor d in one of the blocks currently stored at level k. If d happens to be cachedat level k, then we have what is called a cache hit.

      什么是 cache hits?什么是 cache misses?

    6. It is important to realize that while the block size is fixedbetween any particular pair of adjacent levels in the hierarchy, other pairs of levelscan have different block sizes.

      在 memory hierarchy 之间的 block size 有什么特点?

    7. The central idea of a memory hierarchy is that for each k, the faster and smallerstorage device at level k serves as a cache for the larger and slower storage device

      memory hierarchy 的中心想法是什么?该如何理解?

    8. The memory system must periodically refresh every bit of memory byreading it out and then rewriting it.

      DRAM 不稳定,在计算机中如何防止其变化?

  • Oct 2021
    1. Org-roam caches most of the standard Org properties. The full list now includes: outline level todo state priority scheduled deadline tags
  • Jun 2021
  • Feb 2021
    1. It's difficult because it's a case-by-case basis - there is no one right answer so it falls into subjective arguments.
    2. Space: Suppose we had infinite memory, then cache all the data; but we don't so we have to decide what to cache that is meaningful to have the cache implemented (is a ??K cache size enough for your use case? Should you add more?) - It's the balance with the resources available.
    3. Time: Suppose all your data was immutable, then cache all the data indefinitely. But this isn't always to case so you have to figure out what works for the given scenario (A person's mailing address doesn't change often, but their GPS position does).
    4. The underlying data might get changed by another process and then your process that uses the cache will be working with incorrect data
    5. You have to guess when the data is not likely to be needed in memory. It can't be too short that the cache is useless, and too long that you'll get a memory leak.
    1. So the hard and unsolvable problem becomes: how up-to-date do you really need to be?
    2. After considering the value we place, and the tradeoffs we make, when it comes to knowing anything of significance, I think it becomes much easier to understand why cache invalidation is one of the hard problems in computer science

      the crux of the problem is: trade-offs

    3. The non-determinism is why cache invalidation — and that other hard problem, naming things — are uniquely and intractably hard problems in computer science. Computers can perfectly solve deterministic problems. But they can’t predict when to invalidate a cache because, ultimately, we, the humans who design and build computational processes, can’t agree on when a cache needs to be invalidated.
    4. Cache invalidation is hard because: Everything in life we want to know, changes.Those changes are non-deterministic.
    5. you began by first finding out if your crush was already in a relationship. If so, you then did what you could in your power to have the most most up-to-date information on their relationship status. The downside of outdated data is self-evident: you want to move in at the first sign of the current relationship dissolving.
    6. Sometimes humorously extended as “cache invalidation, naming things, and off-by-one errors.”
    1. There’s only one hard thing in Computer Science: human communication. The most complex part of cache invalidation is figuring out what the heck people mean with the word cache. Once you get that sorted out, the rest is not that complicated; the tools are out there, and they’re pretty good.
    1. One reason Turbolinks sites seem faster than traditional web apps is because of its cache. However, the cache can be a source of great frustration. Many of the edge cases we're going to discuss involve the cache in some way.
  • Jan 2021
    1. They say that there are only two hard problems in computer science: cache invalidation, naming things, and off-by-one errors. Caching is what Service Workers do. It’s literally the #1 hard thing! … or maybe the #0 thing? Whatever. It’s hard.
  • Dec 2020
    1. My next move will be to further lower my visibility to 3rd party tracking with a combination of pi-hole caching DNS blocker and wireguard VPN .
  • May 2020
    1. Using the Git SHA in your image tag makes this less necessary since each job will be unique and you shouldn't ever have a stale image. However, it's still possible to have a stale image if you re-build a given commit after a dependency has changed.
  • Apr 2020
    1. In addition to strings, Redis supports lists, sets, sorted sets, hashes, bit arrays, and hyperloglogs. Applications can use these more advanced data structures to support a variety of use cases. For example, you can use Redis Sorted Sets to easily implement a game leaderboard that keeps a list of players sorted by their rank.

      redis support more data structure memcached is k-v

      memCached is not highly available, beause lack of replication support like redis

  • Mar 2020
    1. not cacheable, unless the response includes appropriate Cache-Control or Expires header fields

      To read more about Cache-Control header see: https://tools.ietf.org/html/rfc7234#section-5.2

  • Oct 2019
    1. Purging by single-file through your Cloudflare dashboard

      This seems like the best way to purge files but I wonder if you can purge by domain or rather files rather than file.

  • Jun 2019
    1. Wong and Gerras did a frightening study of the need for Army officers to lie routinely

      The original PDF is currently unavailable, but Google has cached it here.

  • May 2019
    1. INFERNO VIII↩⚓✪ The Fifth Circle. Intemperance in Indignation⚓✪ The Wrathful and Sullen. Styx. The City of Dis

      The City of Dis refers to the walls that encompasses all of lower hell where the serious sins are punished. Dis, also known as Pluto, is one of the kings of the underworld. Dis represents Lucifer and the lower circles of his infernal realm. It is in The Inferno because it is where the worst sinners reside and is imperative to Dante’s portrayal of his own version of hell.

  • Sep 2018
    1. // Download a json but don't reveal who is downloading it fetch("sneaky.json", {referrerPolicy: "no-referrer"}) .then(function(response) { /* consume the response */ }); // Download a json but pretend another page is downloading it fetch("sneaky.json", {referrer: "https://example.site/fake.html"}) .then(function(response) { /* consume the response */ }); // You can only set same-origin referrers. fetch("sneaky.json", {referrer: "https://cross.origin/page.html"}) .catch(function(exc) { // exc.name == "TypeError" // exc.message == "Referrer URL https://cross.origin/page.html cannot be cross-origin to the entry settings object (https://example.site)." }); // Download a potentially cross-origin json and don't reveal // the full referrer URL across origins fetch(jsonURL, {referrerPolicy: "origin-when-cross-origin"}) .then(function(response) { /* consume the response */ }); // Download a potentially cross-origin json and reveal a // fake referrer URL on your own origin only. fetch(jsonURL, {referrer: "https://example.site/fake.html", referrerPolicy: "origin-when-cross-origin"}) .then(function(response) { /* consume the response */ });
  • Jun 2018
  • Mar 2018
    1. The purpose o this source is to encourage readers to have safer sex.

      Not really, right? I mean, who reads this journal?

    2. itative comparison analyses of the national coverage to help appraise their argument.

      Great! Here you are describing evidence

    3. They


    4. only

      Why "only"?

    5. about Bobby Orr.

      It's not about "Bobby Orr," right?

    1. How are individuals who lived in the Eureka Valley, San Fransico (The Castro) embodied in the Aids Quilt?

      Your sources don't seem to speak to the specific community of Eureka Valley. I wonder why not?

    2. flaw

      why "flaw"?

    3. using incidence, lethality, and morality coefficients

      If these are their terms, you need to put them in quotation marks.

    4. So maybe because he was a man and he also probably wasn’t protected is why he died from aids.

      huh... seems you're seeking and thinking about connections between the person and the epidemic, not your research question.... Do you understand the difference?

    5. ould be anyone

      not "anyone"... "researchers" right?

    6. a different environment, they can really be themsel

      different from what? How specifically does this speak to your research?

    7. The purpose of this article is to see how participation in a friendly gay neighborhood contributes to the variability of gay youth.

      What's missing in these entries is a description of the kinds of evidence the authors use...

    8. connection of my artifact.

      I don't understand... You say the article would be helpful to someone looking for info about gay men of color, and that's what you were looking for, so where does it go wrong for you?

    9. The intended audience for this article would be anyone who wants to know about gay men

      Who reads this journal? Not "anyone"...

    10. There are several authors for this source but Stephen L. Eyre graduated from The University of California with a Ph.D.

      This needs to be one sentence naming all of the authors and citing their general qualifications AND identifying their thesis.

    11. oject preserves panels that ha

      Why center this text? Why is this intro about the NAMES project more than it is about your research project?

    1. This letter was written by Bobby to

      Is this writing "about" the letter? giving a summary? Or is it describing the 'letter'? (Really this is a post card, right?)

    2. That was probably placed there to emphasize that is the name of the person who they lost

      This kind of writing needs to go somewhere else; focus on delivering just "thick description" in the bulk of this page...

    3. The subject of this quilt’s memorial is Bobby Orr is the name on quilt 1333.

      read this sentence out loud. Do you hear what's wrong with it?

    4. els

      Just one, right?

    5. s ther

      comma missing here...

    6. 1960’s.

      Perhaps "from" the 1960s? But not just of this decade, right?

    7. orial “the quilt” so

      memorial, the quilt, ... (notice the commas)

    8. co there mission

      This becomes a runon sentence here. Do you mean... Their mission?

    1. This made me that of ways I can promote or advocate something on social media.

      Develop this idea: what do you mean?

    2. vinyl is a text,


    3. he primary text

      THe next step is to start thinking rhetorically; who is your audience? (not me, not your classmates) What info do they need to have to make sense of this post?

    1. Combing Haltman’s idea of Material culture and 3-d printing we can employ many ways to incorporate touch and serval other senses to our culture sense

      What does this mean?

    2. The authors of the Haltman’s text taught me how to experience an object as space, right then and there. Not only how I would experience but how other people would experience the space of that object.

      THIS IS IT! I think... What would Haltman say about 3D printing (as represented in the 3D article?)

  • Feb 2018
    1. make the connection between the aids epidemic in the 1990’s

      to make the connection between the 90s epidemic and what?

    2. they are trying to fi


    3. the national coverage to help appraise their argument.

      what nation coverage? what argument?

    4.  like bibliographies and tables

      good. what kind of bibliographies? tables of what? The rest of this sentence doesn't yet make sense... what do you mean?

    5. This source connects to my artifact because for Bobby Orr and article like would have been very helpful. Showing and explaining ways to prevent aids/HIV for people just like him.

      But how might this source be useful to you, in your research efforts?

    6. safer sex. The intended audience of this article come be for researchers who are looking for ways to encourage safe sex or possibly college students.  Someone who’s family member who has recently died of aids would possibly be interested in help prevent others from getting aids.

      These sentences don't quite make sense together. Who reads this journal? Why? What for?

    7. he purpose o this source is to encourage readers to have safer sex.

      Are "readers of this source" ... readers of The American Journal of Public Health"... having lots of unprotected sex?

    8. evidence of developing materials

      what does this mean?

    1. Next to the R on the right side of the name is a photo. I believe this photo was placed here because this is a photo of Bobby Orr. The photo is laminated, probably so that it can be preserved for a long time. The laminated photo was stitched on with a blue string. The photo is a bit creased, meaning that it been there for a while. The photo itself has a brown, grey color scheme meaning that it was taken a while ago. This is also assumed because he died in 1989

      Two sentences in this paragraph do not belong. which ones and why...

    2. The 20th century is assumed because in most of the other surrounding panels the date was of the 20th century.

      objective description?

    3. Probably there to emphasize that this is the name of the person they lost.

      Is this objective description?

    4. First I will describe the bold letters and numbers.

      why first?

    5. would be

      'would be'? Is this what you mean? Or do you mean "are"? What 's the difference?

    6. Information about the quilt

      Great! I like how this begins an introduction at the Panel level. This assumes people will read the "about" page or another page for more general information about your project. You might want to add a gloss of that info here... Can you imagine why?

  • Jun 2017
    1. HTTP/1.1定义的 Cache-Control 头用来区分对缓存机制的支持情况, 请求头和响应头都支持这个属性。通过它提供的不同的值来定义缓存策略。

      Request Header与Response Header都支持这个属性 通过调整Cache-Control头可以做出很多缓存策略:

      1. 完全不支持
      2. 不缓存内容
      3. 私有缓存
      4. 公共缓存
      5. 缓存过期时间
    2. 通常定义Pragma以向后兼容基于HTTP/1.0的客户端


    3. 在过期时间前,资源缓存是有效的,反之则缓存失效。通过不停抛弃过期的缓存资源以保证资源的实时性。注意,旧的缓存不会被抛弃或者忽略;当发起一个针对旧缓存资源的请求时,会在请求头里带上If-None-Match用来判断缓存是否还有效。如果有效,服务端返回304(Not Modified)和空的body以节省一部分带宽。


      1. 空间有限
      2. 服务器可能有更新文件


    4. 当 web 缓存发现请求的资源已经被存储,它会拦截请求,返回该资源的拷贝,而不会去源服务器重新下载。


  • May 2017
    1. Optimum buffer size is related to a number of things: file system block size, CPU cache size and cache latency. Most file systems are configured to use block sizes of 4096 or 8192. In theory, if you configure your buffer size so you are reading a few bytes more than the disk block, the operations with the file system can be extremely inefficient (i.e. if you configured your buffer to read 4100 bytes at a time, each read would require 2 block reads by the file system). If the blocks are already in cache, then you wind up paying the price of RAM -> L3/L2 cache latency. If you are unlucky and the blocks are not in cache yet, the you pay the price of the disk->RAM latency as well. This is why you see most buffers sized as a power of 2, and generally larger than (or equal to) the disk block size. This means that one of your stream reads could result in multiple disk block reads - but those reads will always use a full block - no wasted reads. Now, this is offset quite a bit in a typical streaming scenario because the block that is read from disk is going to still be in memory when you hit the next read (we are doing sequential reads here, after all) - so you wind up paying the RAM -> L3/L2 cache latency price on the next read, but not the disk->RAM latency. In terms of order of magnitude, disk->RAM latency is so slow that it pretty much swamps any other latency you might be dealing with. So, I suspect that if you ran a test with different cache sizes (haven't done this myself), you will probably find a big impact of cache size up to the size of the file system block. Above that, I suspect that things would level out pretty quickly. There are a ton of conditions and exceptions here - the complexities of the system are actually quite staggering (just getting a handle on L3 -> L2 cache transfers is mind bogglingly complex, and it changes with every CPU type). This leads to the 'real world' answer: If your app is like 99% out there, set the cache size to 8192 and move on (even better, choose encapsulation over performance and use BufferedInputStream to hide the details). If you are in the 1% of apps that are highly dependent on disk throughput, craft your implementation so you can swap out different disk interaction strategies, and provide the knobs and dials to allow your users to test and optimize (or come up with some self optimizing system).

      What's the cache size to keep when reading from file to a buffer?

  • Feb 2017