Good, bad and evil ... cache
A rather interesting video (in English, unfortunately) in which a girl, using the example of social networks, talks about the pros and cons of caching in web applications.
The first two-thirds of the video are the most informative, which can be summarized as follows:
1) there is a lot of data in social networks now, they are updated frequently, and the user needs to provide them quickly
2) therefore, caching is indispensable
3) it further shows how caching (conceptually) works on Twitter, Facebook and Reddit
4) but there is a problem ...
5) caching in each social network project is manually unsubscribed
6) as a result, we have a lot of code that does almost the same thing in every project. And a lot of code is a lot of bugs and human labor
7) and what to do about it?
8) use the database! Type SQL. Users on social networks work with timelines, and each such timeline in the database language is expressed by a simple query
9) the result of such a query is a plate that is cached by the database itself and is automatically updated as the base tables based on which it was calculated
10) but then again the problem ...
11) implementation of modern database is not so smart, so they can be used in the form in which they are offered
12) are centralized, they can not teach the semantics of the application, you can not make friends with the client caches and ... Next conductive drawback I particularly liked. I’ll even highlight it in a separate paragraph
13) academic science has already decided everything for a long time, but for some reason, the developers of the database are dumb and behind the progressive humanity by three decades (the wording is free, but I can’t just get past this rather naive, in my opinion, judgment)
rest of the video It seemed rather muddy to me. The girl tells what to do with the database so that everything “flies.” Unfortunately, she does not offer any specifics, so I don’t even know what you can write about this part of the video here. So see the video. However, in a nutshell, then:
14) the "fat" clients (who should "bear" a significant part of the application) will save the world and
15) client-side caching, consistent with server-side caching
In general, the answer to "the main question of life, the universe and all that "as it always slipped away. The most interesting part of the conversation turned out to be meaningless. Nevertheless, I still recommend the video, because the problem statement is given quite clearly and clearly. Besides, the girls in IT - it’s wonderful. We should welcome it in every way.
If we still discuss it, the proposal to use “thick” clients might seem rather nontrivial. This is something that we would like, for example, to Intel, which obviously would not mind putting high-performance products in every computer again It’s an awesome general-purpose processor. Nevertheless, the world is moving in the opposite direction so far. It’s hard to say what will happen in the future. Perhaps there really are some killer applications that will force us all to buy “irons.” Who knows ...
About SQL everywhere - the idea is tempting and excites many. It is possible that it is in social networks, after some improvements, that it will take root. Still, whatever one may say, social network queries to the database are a relatively simple thing. The variety of queries is small, and they are not very complex. Therefore, in my opinion, you can even afford not to use any databases, but to write everything manually (as, in fact, is now being done). Those. the very “lot of code” that the girl complains about, it seems to me, is not at all the “super code” that would have to be written for the optimal operation of systems that process hundreds or thousands of heterogeneous requests. Here, just, it is difficult to use a ready-made database. It is possible to optimize it for some class of requests, but requests from another class will constantly go past caches or, what’s good, generally break down caches. Apparently to this, the author of the report would answer that she also wants to “marry” the database with application semantics. But she does not say how to do it, so there’s nothing to discuss here yet ...
That’s it, that's all ...
UPD: the article is devoted to caching problems. Therefore, I removed the arguments on the subject of Java Script (for some reason, they attracted the attention of all unsubscribes). I do not like holivars ...