[00:00:00] Sachin, sorry Sachin, I do not think I have access to the attendance, but anyhow let me [00:00:21] just check and also for the PPTs, sorry guys I did not get time last week, so anyhow after the class [00:00:34] today after my dinner I will definitely upload. I am just sharing my screen, can one of you confirm [00:00:48] that you are able to see my screen. Okay, cool, thank you very much. [00:01:18] Hey, cool, still I see 155, let us give one more minute. I think 155 is fine, we can get started. [00:01:45] Okay, let us get started. So, the whole course we were trying to understand how the hardware works, [00:02:00] how the hardware interacts with the software, how our application performs, what are the basis for [00:02:12] our application performance. We did understand the breakup of the architecture, how the instructions [00:02:24] have been sent to the processor, how processor processes them, the role of other components such as RAM storage, [00:02:37] the network devices. And we have also seen in detail how system processes are getting created, [00:02:52] how we are able to identify the processes, [00:02:55] and how can we identify which processes consuming more resources. So, all these things we have understood. [00:03:10] So, it is time for us to understand the memory. [00:03:13] So, today we are going to look beneath the software layer. We will see that processor's performance [00:03:27] depends not only on the instructions it executes, but also on how quickly it can obtain the data [00:03:35] data those instructions need. Now, have you ever seen two implementations [00:03:47] that produce the same result, but run at noticeably different speeds? [00:03:53] It could be related to database, it could be related to databases, analytics, image processing, [00:04:01] or application development. So, basically, this is a performance oriented architecture session, [00:04:10] not simply list of memory definitions. It is definitely not that. Okay, cool. Now, [00:04:23] we will move in four steps. First, why computers need a hierarchy. Second, how cache and locality work. [00:04:41] Third, how cache decides where data goes and what gets replaced. Finally, we will connect these ideas [00:04:53] to the way a matrix is reversed into the memory. So, basically, today we will see, we will start with the [00:05:07] conceptual session. We will continue with that tomorrow and then we will also get into the practical session demonstrations. [00:05:18] So, basically, the CPU memory performance gap. That is one motivation for us to understand better. [00:05:32] Then, how cache hits misses or cache lines and locality. The third is basically the mechanisms, [00:05:40] mapping replacement and write policies. So, [00:05:52] one question that we need to ask ourselves throughout. What data will the processor need next? [00:06:00] And where is that data likely to be? If we start linking the processors to the data requirement, [00:06:15] then definitely we will be able to start understanding the importance of the memory. [00:06:23] Now, we should be able to explain the performance difference after this session. Not just memorize that one loop is faster and [00:06:37] another loop is slower. Not like that. Cool. [00:06:43] Now, by the end of this session, between today and tomorrow, we should be able to explain the hierarchy. [00:06:58] Describe what a cache hit and miss mean. Distinguish temporal from spatial locality. [00:07:08] And the reason about how a program's access interacts with caching. That is our objective between today and tomorrow. [00:07:25] So, now, if we expect this, then which outcome is least familiar for you? Is it locality? Or is it cache mapping? Or write policies? Or row major layout? [00:07:52] Or row major layout? Obviously, [00:07:57] All of you should have one or two, at least one or two least familiar concepts, which we will get [00:08:08] a better understanding by end of the session. So, now the question comes, [00:08:16] is a fast CPU enough? [00:08:22] The assumption that processor speed alone determines the program speed. [00:08:35] Is that good enough? Imagine a processor capable of executing billions of operations per second. [00:08:45] Does that guarantee? Does that guarantee that every application will be fast? [00:08:53] We have got one of the best [00:08:57] processor. But is it going to guarantee that [00:09:02] every application that we are going to run will be running fast? [00:09:06] First, what if the processor needs data that has not arrived yet? [00:09:16] Now, I'll just give some 10-20 seconds. [00:09:21] Just think about it. Especially, what if the processor needs data that has not arrived yet? [00:09:29] Instructions we know. It will go to the processor. But how about data? [00:09:40] Just 10 seconds, please think about it. [00:09:42] Okay. So, any response? Anything? Please give me in the chat. [00:09:57] I see no from Gyan and Ateesh. Not sure what is that for. [00:10:14] Okay. Understood. No means, not only the processor is enough. But what else it requires? [00:10:22] Okay. Where will the data come from? [00:10:37] Okay. I do see [00:10:40] two responses. One says memory, another says hard disk. [00:10:46] Okay. CPU waste time for data is a wastage leads to slow processing. [00:10:52] I understand. Processor has to wait for the data. Without data, it will not be able to [00:11:00] run. I understand. Most used data kept in cache to speed up. Okay. Perfect. [00:11:11] Do that. What do you mean by other factors also matter? What other factors? [00:11:15] A production server runs several processes. One process is eligible to execute but is waiting [00:11:28] for CPU time. Another process is waiting for data to arrive from a disk operation. [00:11:34] Oh, great. Now, what is the difference between RAM and main memory? [00:11:45] So, hardware, software optimization. That is interesting. Okay. [00:11:56] See, basically, we need to think, how is it going to pair? What can make the CPU wait? [00:12:04] The CPU data will make it wait? RAM is a temporary. RAM is main and RAM is temporary memory. Both are correct. [00:12:17] Perfect. Cool. [00:12:20] For example, RAM is memory. It is temporary, but the disk is persistence. [00:12:30] If processor is starved for data, then it enters still state. Still state means it doesn't know what to [00:12:40] do next and it hangs. That hanging of processing is definitely not a desired state. [00:12:51] Oops. Satya. I feel data can come from any source. Then that will be moved to the flow. [00:13:00] In the previous classes like IO buses, it will go through the CPU and processing happens. [00:13:05] Thank you very much for linking. Okay. Thank you very much for linking. This is one of the responses [00:13:12] that I was expecting and thank you very much for that response Satya. Great. [00:13:19] Now, here the key thing is the processor can be extremely fast, but it cannot operate on data [00:13:30] that has not arrived. That is the key. Having just a fast CPU is not enough unless you supply the data that is required. [00:13:46] For example, if you want to determine if the value is against a certain comparator, [00:13:56] then that comparator needs to come from the memory. If it is not in the memory, it has to be read from the hard disk. [00:14:06] When you say hard disk, it is the storage. The storage can be local. The storage can be remote. [00:14:13] If it is remote, it can be within the network. It could be outside the network. [00:14:18] If it is outside the network, it could be reachable over virtual private network or it could be reachable over public internet. [00:14:32] If it is reachable over public internet, wherever it is available should be reachable. [00:14:39] So, so many things, so many things comes into the play. So, this could lead to a CPU memory performance gap. [00:14:53] The processor execution capability and memory access latency have not improved at the same pace. [00:15:12] One is processor, second is main memory. Let us speak about DRAM or SDRAM. [00:15:18] So, a CPU can have many execution resources, but those resources need instructions, not only instructions, but also data. [00:15:31] If an instruction depends on a value that is still being fetched from the memory, the processor may have to wait. [00:15:39] The bottleneck is then data moment, not arithmetic. The calculation still can be performed at a faster pace because we do have [00:15:52] CPU available for the application or the calculation, but the data moment is a bottleneck. [00:16:00] Now, when you say memory, memory, we always call it as memory wall. What is a memory wall? [00:16:15] The performance gap between processor capability and memory access. That is the memory wall. So, two different [00:16:24] resources. One is memory. Second is processor. And in case if memory is deteriorating the processing capability of the CPU, [00:16:37] then we call it as memory wall. If it is constrained by the time needed to move data, [00:16:47] it could be nanoseconds. It could be nanoseconds. It could be microseconds. It could be milliseconds as well. [00:16:54] So, this is one reason. This is one reason that we try to keep the data [00:17:03] in a network that is accessibly fast enough. [00:17:07] So that it could be a database. It could be a flat file. It could be an image. It could be a video. [00:17:17] If it is an image processing software, [00:17:21] then what is going to be retrieved is an image. It could be from an S3 bucket. [00:17:28] So, the application where we are running could be Azure environment. [00:17:33] The S3 bucket, basically the storage we are using from AWS. [00:17:41] And it is pretty much possible that we wanted to use the database from the GCP. [00:17:47] Three different environments, multi-cloud. [00:17:49] Now, unless we ensure that the database access and the image access from the S3 bucket is [00:17:58] fast enough, then the virtual machines that even have [00:18:08] fastest CPU and also more number of CPU cores is not going to help. [00:18:14] So, if you remember in our last session, for the same program, we saw two different performance, [00:18:24] for the same program. At the point of time, I said like the number of CPUs [00:18:32] being same, why was the performance was slower? We did observe that. Same program run in two different [00:18:45] instances, has two different performance measures. So, that was within the CPU. Number of cores, type of CPU, [00:19:02] if that itself, there is a performance gap, then in addition to memory, the new resource, [00:19:12] will we be able to experience it as an end user? May or may not be. There is no straight answer to it. [00:19:22] As long as it is in nanoseconds and milliseconds, as an end user, I will not be able to experience it. [00:19:28] But I will assume that it takes a couple of seconds. A couple of seconds is too much of a time [00:19:35] for me to wait as an end user. So, I will definitely observe the difference. [00:19:41] So, can a program be limited by data moment rather than arithmetic? [00:19:50] We have the answer now. The answer is memory wall. It is pretty much possible. [00:19:54] Now, if we are going to observe this and if we understand this, how are we going to handle it? [00:20:07] Now, if a program performs very little arithmetic, let us assume our application is performing a very [00:20:23] little arithmetic, but repeatedly fetches data from far away memory locations. [00:20:34] What might limit its speed? [00:20:35] One definitely could be the latency, the memory latency. Second, it could be the network bandwidth also. [00:20:49] It is not only about the memory. Now, we have gotten another entity. See, the memory is accessible faster. [00:20:59] But the bandwidth is slow. What can we do? [00:21:12] So, do we increase the bandwidth and then check if memory access is faster? [00:21:19] And then finally observe, is the processor processing as expected? [00:21:24] And what is the difference between or what is the distinction between latency and bandwidth? [00:21:35] Latency is measured in time and bandwidth is measured by the amount of data transferred per unit time. [00:21:45] It could be like 2mbps, that means 2mbps, or it could be 2gbps, or it could be 2pbps. [00:21:58] That is how the bandwidth is measured. How the latency is measured? Latency is measured against time. [00:22:07] How much time you took to access? [00:22:09] So, now the bandwidth could be the reason that you are taking more time to access the memory from the external system. [00:22:21] You might have good bandwidth, but still your memory accessibility is slower. You are able to observe it. [00:22:31] How? Because basically I was going through the logs. It says that it is taking to access it by 2ms [00:22:44] and 3ms, which is not acceptable. If there are like 15 processors to be processed by the CPU, [00:22:54] and all the 15 processors related to the same application, and if the application is waiting for a response from [00:23:03] the completion of these 15 processors, then the user is waiting. [00:23:10] So, you say like 2ms per process, then for 15 processors, it is 30ms. [00:23:17] 30ms. User will be able to experience it. 30ms, 1 second. That is experienceable. [00:23:31] Notice the expectation from the end user is, even if you see in most of the portals, for example, [00:23:41] to obtain the OTP. You will be sent OTP, both to your mobile and email as well. [00:23:51] But still, as a user, if you are going to experience, [00:23:57] as a user, if you are going to experience like 3 to 5 seconds of delay, [00:24:11] then are you going to wait? Though the portal is going to tell, [00:24:18] this OTP is valid for 10 minutes. That means even if it arrives at the 9th minute, [00:24:30] it is still valid, you can supply it, and it can be authenticated. [00:24:35] That is pretty much possible. But as an end user, are we simply going to wait for 9 minutes? [00:24:47] Do we have so much of patience? [00:24:52] No, definitely not. [00:24:55] Just give me a minute, please. [00:25:00] Hi, guys. Just can one of you confirm. Am I audible? Am I clear? [00:25:28] I am able to see the activity in my mic. [00:25:31] I just wanted a confirmation from your end as well. [00:25:38] Okay, great. Thank you so much. [00:25:42] Now, if a program performs very little arithmetic, but repeatedly fetches data, OTP is a great example. [00:25:50] The program just generates probably four digits, six digits, and gives to the API that is going to send it to your email and SMS. [00:26:03] And after that, immediately it will display the next page for you to supply the OTP for authentication. [00:26:15] All these things will happen within not even one second. [00:26:21] Now, immediately the screen that comes up asking for the OTP, what you are going to do is immediately you are going to check your mobile or email. [00:26:32] Why I have not received yet? [00:26:36] So, if you look at these two processes, initiating the OTP is just a small logic which it will initiate and give it to the API. [00:26:46] But the other end, the screen comes up immediately for accepting the OTP. [00:26:52] But this OTP has to travel through network. [00:26:58] It has to travel outside of the network where the application is running. [00:27:03] It has to go to the gateway where [00:27:05] the interface is accepting the OTP to be transmitted to two different networks. [00:27:14] One is your mobile network. [00:27:16] Second is your computer network. [00:27:19] And from there, it has to find out which is your mail server. [00:27:24] Put the mail into that mail server and the mail server needs to accept the mail. [00:27:30] Put it in your inbox. [00:27:31] The moment it arrives into the server inbox, it has to come into your Outlook in case if you are using Outlook. [00:27:40] Or you need to refresh the Gmail page so that you will get it. [00:27:47] On the other hand, the message also needs to go to the mobile network and the mobile network has to [00:27:53] send it to your number. [00:27:54] Your number should receive it and then it will display. [00:27:58] Your number should receive it. [00:27:59] There are two processors that are running in parallel. [00:28:03] But processor is displaying the pitch immediately. [00:28:07] So, now you should be in a position to understand [00:28:14] why it is taking like two seconds at least for us to receive the OTP. [00:28:20] And why we don't have patience. [00:28:22] As an end user, we will not have. [00:28:26] XYZ bank is sending the OTPs so fast [00:28:29] compared to ABC bank, we will start doing that comparison immediately. [00:28:36] And today having multiple bank accounts with multiple banks is a normal thing. [00:28:42] So, the user experience is going to be compared immediately. [00:28:47] Some of the bank has pressure. [00:28:49] Sometimes the bank has a provider. [00:28:51] It has a provider. [00:28:51] So, now X, Y, Z bank might be having the mobile network gateway connected to Airtel. [00:29:01] Whichever connection you have in your mobile, they might have an API gateway with Airtel. [00:29:09] Another bank might have the gateway with Jio. [00:29:12] and you may have [00:29:17] probably why [00:29:21] so now it has to [00:29:23] again go through two different networks [00:29:26] all this process [00:29:28] needs to happen [00:29:29] so now at one end of the process [00:29:32] CPU has completed its job [00:29:34] now the data is supposed to be [00:29:36] supplied [00:29:36] so now [00:29:38] what will happen [00:29:41] to the application [00:29:43] application will move [00:29:45] from the CPU that particular [00:29:47] set of instructions is completed [00:29:50] so it will [00:29:51] the next set of instructions it will wait for [00:29:54] and all the instructions [00:29:56] will be in the queue [00:29:57] same application [00:29:59] some other user might be [00:30:01] looking at [00:30:02] the bank balances [00:30:05] some might be transacting money [00:30:08] some would be [00:30:10] like changing the password [00:30:12] some [00:30:14] might be looking at the [00:30:17] statements [00:30:18] past three months statement [00:30:20] somebody wants to download [00:30:22] so so many processes [00:30:24] that comes [00:30:25] at the same time [00:30:27] but every process [00:30:30] has a different requirement [00:30:32] for the data [00:30:33] now if you are downloading [00:30:35] the statement [00:30:36] for the last three months [00:30:38] basically the application [00:30:40] needs to get your authentication [00:30:44] go back [00:30:46] select the data from the database [00:30:48] for three months [00:30:49] import it [00:30:51] create it as a PDF [00:30:53] and then give it to your interface [00:30:56] it just [00:30:57] when you are seeing that [00:30:58] please click here [00:30:59] to download your PDF [00:31:01] the bank's website [00:31:03] that is just an instruction set [00:31:06] processed by the CPU [00:31:07] to display the information [00:31:10] on the screen [00:31:10] that's all [00:31:11] moment you click it [00:31:13] is again going to go back [00:31:15] to the storage [00:31:15] retrieve the PDF [00:31:16] and then it will start [00:31:18] downloading to your laptop [00:31:20] this has its own cycle [00:31:23] of data requirement [00:31:25] now changing the password [00:31:30] it actually does not [00:31:32] require any data [00:31:34] to be travelled [00:31:35] and depends on the logic [00:31:40] in which the application [00:31:41] has been built [00:31:42] for the password change [00:31:44] generally one cycle [00:31:45] of authentication [00:31:46] is what [00:31:47] this is one additional [00:31:50] cycle of authentication [00:31:51] required for the password change [00:31:53] so that will happen [00:31:55] very fast [00:31:56] that is the reason [00:32:00] in most of the banks [00:32:01] website today [00:32:01] if you observe [00:32:02] if you are trying [00:32:04] to download [00:32:05] your statement [00:32:07] for the last [00:32:07] three months [00:32:08] or six months [00:32:09] some of the banks [00:32:10] allow you to download [00:32:12] the statement [00:32:12] for five years [00:32:13] and seven years [00:32:14] that has been [00:32:16] given a lowest [00:32:18] rarity [00:32:18] because it has to [00:32:20] coordinate with the storage [00:32:21] get the data [00:32:22] create the PDF [00:32:23] store the PDF [00:32:24] and display the link [00:32:26] from where [00:32:27] the PDF can be downloaded [00:32:29] so that's the reason [00:32:32] some of the banks [00:32:34] have started displaying [00:32:35] once it is ready [00:32:38] we will [00:32:38] inform you [00:32:40] then you can come back [00:32:42] and download [00:32:42] earlier [00:32:45] basically [00:32:47] if you are the user [00:32:48] and if you are accessing [00:32:49] the PDF file [00:32:51] to be downloaded [00:32:52] for last three months [00:32:53] the processor [00:32:56] will change [00:32:57] and it will [00:32:57] the arrow mark [00:32:58] will change [00:32:59] in your laptop [00:32:59] and it will be [00:33:01] rounding [00:33:02] roaming [00:33:02] clock [00:33:03] whatever it is [00:33:04] so we [00:33:06] used to wait [00:33:07] until all these [00:33:08] processes are completed [00:33:09] and the [00:33:10] link coming up [00:33:11] on the web page [00:33:12] but nowadays [00:33:14] they are very clear [00:33:15] it may take [00:33:16] like three seconds [00:33:17] it may take [00:33:18] even 30 seconds [00:33:19] it may take [00:33:21] even one hour [00:33:22] they simply [00:33:25] say that [00:33:25] once it is ready [00:33:26] we will inform you [00:33:27] and this statement [00:33:28] will be available [00:33:29] for you [00:33:29] for the next [00:33:31] 24 hours [00:33:32] or 48 hours [00:33:33] to download [00:33:34] so they have [00:33:36] also changed [00:33:37] the reason [00:33:37] there is a [00:33:40] mismatch [00:33:40] between the [00:33:41] CPU performance [00:33:42] and the [00:33:42] memory performance [00:33:44] and the data [00:33:45] availability [00:33:46] for the application [00:33:49] for that [00:33:50] particular feature [00:33:51] that is not [00:33:53] the case [00:33:54] of OTP [00:33:54] authentication [00:33:55] that is not [00:33:57] the case [00:33:58] to look [00:33:59] for a transaction [00:34:00] because it is [00:34:01] getting displayed [00:34:02] on the screen [00:34:03] only [00:34:03] but for download [00:34:06] they have [00:34:06] changed their [00:34:07] logic [00:34:07] so can a [00:34:10] program be [00:34:11] limited by [00:34:11] data moment [00:34:12] the answer [00:34:13] is [00:34:13] it can be [00:34:16] limited by [00:34:18] data moment [00:34:18] okay [00:34:22] especially in [00:34:24] case of [00:34:25] fetching the [00:34:27] data for [00:34:28] three months [00:34:28] last three months [00:34:30] maximum what [00:34:31] it will it will [00:34:32] ask for from [00:34:33] date and to [00:34:34] date [00:34:34] if it is [00:34:41] arbitrary dates [00:34:43] that we [00:34:43] wanted to [00:34:44] supply [00:34:44] or last [00:34:46] three months [00:34:46] one option [00:34:47] may be there [00:34:48] if you select [00:34:50] that also [00:34:50] a little [00:34:51] data [00:34:52] a little [00:34:53] instruction [00:34:54] to be [00:34:55] processed [00:34:56] now [00:34:58] we have [00:35:02] seen like [00:35:03] how the [00:35:06] data [00:35:06] movement [00:35:06] is limiting [00:35:09] the program [00:35:10] performance [00:35:11] because of [00:35:14] two different [00:35:15] resources [00:35:15] one is [00:35:16] processor [00:35:16] and main [00:35:17] memory [00:35:17] now let [00:35:21] us look at [00:35:22] the hierarchy [00:35:23] of the [00:35:24] memory [00:35:24] we have [00:35:25] understood in [00:35:26] detail the [00:35:26] processor [00:35:27] now let us [00:35:28] look at the [00:35:29] hierarchy of [00:35:30] the memory [00:35:30] if you remember [00:35:34] we have seen [00:35:34] this diagram [00:35:35] once before [00:35:36] when we got [00:35:40] introduced to [00:35:41] the memory [00:35:42] hierarchy [00:35:45] initially [00:35:45] in the [00:35:46] introduction [00:35:47] session [00:35:47] see at the [00:35:49] top what we [00:35:50] are seeing [00:35:50] is the [00:35:51] registers [00:35:51] though it [00:35:54] is within [00:35:54] the CPU [00:35:55] it is also [00:35:55] a storage [00:35:57] it is also [00:35:59] a memory [00:36:00] which hold [00:36:03] values used [00:36:04] directly by [00:36:05] instructions [00:36:05] whatever comes [00:36:08] out of the [00:36:08] instructions [00:36:09] is stored [00:36:10] in the [00:36:10] registers [00:36:11] now below [00:36:14] them are [00:36:14] L1 [00:36:15] L2 [00:36:15] and L3 [00:36:16] cache [00:36:16] this also [00:36:17] we saw [00:36:18] in detail [00:36:19] this is also [00:36:20] part of [00:36:21] the CPU [00:36:22] how it [00:36:24] access [00:36:25] how fast [00:36:28] it is [00:36:28] L1 cache [00:36:29] is very [00:36:29] fast [00:36:30] because it [00:36:30] is easily [00:36:32] accessible [00:36:32] by the [00:36:33] CPU [00:36:34] and it [00:36:36] is next [00:36:36] to the [00:36:36] CPU [00:36:37] now the [00:36:40] fast [00:36:40] actually [00:36:41] the [00:36:42] speed [00:36:42] actually [00:36:44] reduces [00:36:44] as we [00:36:46] move downwards [00:36:47] in this [00:36:48] hierarchy [00:36:48] now we [00:36:51] have [00:36:51] main [00:36:52] memory [00:36:52] it is a [00:36:55] dynamic [00:36:55] read [00:36:56] random [00:36:57] access [00:36:57] memory [00:36:58] it is a [00:36:59] read only [00:37:00] memory [00:37:00] now [00:37:04] this [00:37:06] DRAM [00:37:08] is the [00:37:10] first [00:37:11] layer of [00:37:12] memory [00:37:12] outside of [00:37:13] the CPU [00:37:14] even this [00:37:16] memory also [00:37:16] is going to [00:37:17] reside in the [00:37:18] same [00:37:18] motherboard [00:37:19] CPU also [00:37:21] is in the [00:37:22] same [00:37:22] motherboard [00:37:23] within CPU [00:37:24] we have [00:37:24] registers [00:37:25] L1 [00:37:26] L2 [00:37:26] and L3 [00:37:27] next to [00:37:28] the CPU [00:37:28] we will [00:37:29] have the [00:37:29] RAM [00:37:30] residing [00:37:31] in the [00:37:31] same [00:37:32] motherboard [00:37:33] now [00:37:36] beyond [00:37:38] DRAM [00:37:39] beyond [00:37:40] it could [00:37:40] be [00:37:40] SD RAM [00:37:41] also [00:37:42] that is [00:37:44] synchronized [00:37:45] dynamically [00:37:46] random [00:37:47] access [00:37:48] memory [00:37:48] nowadays [00:37:50] SD RAM [00:37:50] is what [00:37:51] being used [00:37:52] in the [00:37:52] systems [00:37:52] that is [00:37:54] faster than [00:37:54] DRAM [00:37:57] is faster [00:37:57] than [00:37:57] RAM [00:37:58] so in [00:38:00] today's [00:38:01] world [00:38:01] we started [00:38:02] using [00:38:02] SD RAM [00:38:03] but it [00:38:06] is [00:38:06] volatile [00:38:08] means [00:38:08] you cannot [00:38:10] depend on [00:38:11] the data [00:38:12] availability [00:38:12] that is [00:38:13] stored in [00:38:14] the [00:38:14] SD RAM [00:38:14] so beyond [00:38:17] RAM [00:38:18] is the [00:38:18] persistency [00:38:20] that comes [00:38:21] in [00:38:21] registers [00:38:23] L1 [00:38:24] L2 [00:38:24] L3 [00:38:25] and [00:38:25] local [00:38:27] main [00:38:28] memory [00:38:28] all of [00:38:30] them do [00:38:30] not have [00:38:31] the quality [00:38:32] persistence [00:38:33] the persistence [00:38:37] comes only [00:38:38] with the [00:38:40] local [00:38:40] hard disk [00:38:41] now RAM [00:38:44] also it has [00:38:44] its own [00:38:45] slot within [00:38:46] the motherboard [00:38:47] similarly [00:38:49] hard disk [00:38:50] also is [00:38:50] connected to [00:38:51] the motherboard [00:38:52] so until [00:38:57] here it is [00:38:57] all within [00:38:59] the motherboard [00:38:59] these four [00:39:02] is within [00:39:03] the CPU [00:39:04] registers [00:39:05] L1 [00:39:05] L2 [00:39:05] L3 [00:39:06] cache [00:39:06] registers [00:39:08] these up [00:39:10] to local [00:39:11] hard disk [00:39:12] everything is [00:39:14] in the same [00:39:15] motherboard [00:39:16] so obviously [00:39:18] the [00:39:19] access speed [00:39:22] will be [00:39:23] comparatively [00:39:24] more [00:39:24] in case [00:39:27] if you are [00:39:27] accessing it [00:39:28] from the [00:39:28] S3 bucket [00:39:30] obviously is a [00:39:31] remote storage [00:39:33] because it is [00:39:34] in the AWS [00:39:35] network [00:39:36] assuming that [00:39:38] you are running [00:39:39] an application [00:39:39] in Azure [00:39:40] and your [00:39:42] storage bucket [00:39:43] is in AWS [00:39:45] then for the [00:39:48] application [00:39:48] the S3 [00:39:49] is remote [00:39:51] yeah [00:39:54] this is where [00:39:55] exactly [00:39:55] the bandwidth [00:39:58] ability also [00:39:59] comes into [00:40:00] the picture [00:40:00] the moment [00:40:02] your storage [00:40:02] is remote [00:40:04] now [00:40:07] capacity [00:40:10] tends [00:40:11] to increase [00:40:12] downward [00:40:13] what I mean [00:40:15] is that [00:40:16] how much [00:40:16] is the [00:40:17] capacity [00:40:17] of [00:40:18] registers [00:40:18] how much [00:40:19] data [00:40:20] they will [00:40:20] be able [00:40:20] to store [00:40:21] in L1 [00:40:22] to L3 [00:40:22] cache [00:40:23] how much [00:40:24] data [00:40:25] that can [00:40:26] be stored [00:40:26] in [00:40:27] SDRAM [00:40:28] and how [00:40:30] much [00:40:30] data [00:40:30] it can [00:40:31] be stored [00:40:31] in [00:40:32] hard disk [00:40:32] it is [00:40:35] basically [00:40:36] the capacity [00:40:38] is increasing [00:40:39] but latency [00:40:41] also [00:40:42] increases [00:40:42] parallel [00:40:44] both of [00:40:46] them [00:40:46] is in [00:40:47] the [00:40:47] increasing [00:40:47] trend [00:40:48] from [00:40:48] top [00:40:48] to [00:40:48] bottom [00:40:49] definitely [00:40:51] if it [00:40:51] is a [00:40:52] remote [00:40:52] storage [00:40:52] in remote [00:40:55] storage [00:40:55] there is [00:40:56] no [00:40:56] limitation [00:40:56] for [00:40:57] S3 [00:40:57] what it [00:40:58] only thing [00:41:00] is [00:41:00] your cost [00:41:01] is going [00:41:02] to increase [00:41:02] but your [00:41:05] latency [00:41:06] is also [00:41:06] going to [00:41:07] increase [00:41:08] and [00:41:10] capacity [00:41:11] also [00:41:11] increases [00:41:12] so [00:41:15] everything [00:41:15] increases [00:41:16] from top [00:41:16] to bottom [00:41:16] ability [00:41:19] to save [00:41:19] the amount [00:41:21] of data [00:41:22] to save [00:41:22] how fast [00:41:25] you can [00:41:25] access the [00:41:25] data [00:41:26] and the [00:41:29] persistence [00:41:30] so let [00:41:34] me just [00:41:34] hold on [00:41:35] here [00:41:36] let me [00:41:37] ask you [00:41:38] a query [00:41:38] suppose [00:41:41] if you [00:41:44] are going [00:41:44] to store [00:41:45] 25,000 [00:41:48] images [00:41:48] that is [00:41:50] the rate [00:41:51] in which [00:41:52] you are [00:41:52] receiving [00:41:52] you receive [00:41:54] 25,000 [00:41:55] images [00:41:56] in an [00:41:57] hour [00:41:57] from [00:41:59] different [00:41:59] sources [00:42:00] from your [00:42:00] customers [00:42:01] network [00:42:02] from your [00:42:04] end [00:42:04] customers [00:42:04] upload [00:42:05] sources [00:42:06] can be [00:42:07] different [00:42:07] but you [00:42:08] are receiving [00:42:09] 25,000 [00:42:10] images [00:42:10] in an [00:42:11] hour [00:42:11] and these [00:42:13] images [00:42:14] are to [00:42:14] be [00:42:14] processed [00:42:15] and it [00:42:18] will be [00:42:18] processed [00:42:18] by an [00:42:19] application [00:42:19] written [00:42:20] by us [00:42:20] only [00:42:20] and [00:42:22] it will [00:42:23] meet the [00:42:24] expectations [00:42:24] of the [00:42:25] customer [00:42:25] along with [00:42:26] image [00:42:27] upload [00:42:27] or along [00:42:28] with [00:42:28] image [00:42:29] transfer [00:42:30] what is [00:42:32] expected [00:42:32] for the [00:42:33] image [00:42:33] transition [00:42:34] is also [00:42:35] going to [00:42:36] be [00:42:36] available [00:42:36] so that [00:42:37] means [00:42:37] data [00:42:39] itself [00:42:39] the [00:42:41] expectation [00:42:42] that is [00:42:42] the [00:42:42] instruction [00:42:43] set [00:42:43] the [00:42:46] size [00:42:47] all the [00:42:49] three [00:42:49] matters [00:42:50] now [00:42:52] the [00:42:52] application [00:42:52] needs [00:42:53] to [00:42:53] restore [00:42:54] or [00:42:55] retrieve [00:42:56] the [00:42:56] data [00:42:56] from [00:42:56] the [00:42:56] remote [00:42:57] storage [00:42:57] as [00:42:57] revoked [00:42:58] let us [00:43:00] say [00:43:01] that [00:43:01] one [00:43:02] image [00:43:02] on an [00:43:04] average [00:43:04] it takes [00:43:05] one [00:43:08] millisecond [00:43:10] to [00:43:11] process [00:43:11] will you [00:43:14] be able [00:43:14] to [00:43:15] process [00:43:15] all the [00:43:16] incoming [00:43:16] 25,000 [00:43:17] messages [00:43:18] in one [00:43:19] hour [00:43:19] itself [00:43:20] so all [00:43:23] you have [00:43:24] to do [00:43:24] is [00:43:24] how many [00:43:25] milliseconds [00:43:25] per hour [00:43:26] and [00:43:29] 25,000 [00:43:30] milliseconds [00:43:30] if it [00:43:31] is more [00:43:32] than [00:43:32] one [00:43:32] hour [00:43:33] or [00:43:33] less [00:43:34] than [00:43:34] one [00:43:34] hour [00:43:35] that's [00:43:38] all [00:43:38] you need [00:43:38] to [00:43:38] just [00:43:39] take [00:43:39] like [00:43:39] 10 [00:43:40] 20 [00:43:40] seconds [00:43:40] question [00:43:42] is very [00:43:43] simple [00:43:43] you are [00:43:43] receiving [00:43:44] 25,000 [00:43:44] images [00:43:45] in an [00:43:45] hour [00:43:46] on an [00:43:48] average [00:43:48] and on [00:43:49] an [00:43:49] average [00:43:49] every [00:43:50] image [00:43:52] requires [00:43:52] one [00:43:53] millisecond [00:43:54] to [00:43:54] process [00:43:54] even [00:43:56] if your [00:43:57] image [00:43:57] takes [00:43:58] yeah [00:43:58] that's [00:43:58] sure [00:43:59] Amit [00:43:59] even [00:44:01] if your [00:44:01] image [00:44:02] takes [00:44:03] two [00:44:04] milliseconds [00:44:04] to [00:44:04] process [00:44:05] still [00:44:07] you will [00:44:07] be able [00:44:07] to [00:44:08] complete [00:44:08] the [00:44:08] entire [00:44:09] processing [00:44:09] of the [00:44:10] 25,000 [00:44:10] images [00:44:11] because [00:44:11] it [00:44:13] should [00:44:13] not [00:44:14] take [00:44:14] more [00:44:15] than [00:44:15] a [00:44:16] minute [00:44:16] but [00:44:20] I'm [00:44:21] telling [00:44:21] like [00:44:22] one [00:44:23] hour [00:44:23] so [00:44:26] that [00:44:26] means [00:44:26] suddenly [00:44:27] you [00:44:27] observe [00:44:28] that [00:44:30] your [00:44:32] system [00:44:32] has [00:44:32] gone [00:44:33] slow [00:44:33] this [00:44:35] is [00:44:35] what [00:44:36] is [00:44:36] the [00:44:36] performance [00:44:37] and [00:44:37] it [00:44:38] used [00:44:38] to [00:44:38] perform [00:44:38] whatever [00:44:40] you [00:44:40] receive [00:44:40] in [00:44:41] one [00:44:41] hour [00:44:41] can [00:44:42] be [00:44:42] performed [00:44:42] in [00:44:42] 30 [00:44:43] seconds [00:44:43] that's [00:44:46] the [00:44:46] capability [00:44:46] you [00:44:47] have [00:44:47] but [00:44:49] suddenly [00:44:49] you [00:44:50] see [00:44:50] that [00:44:50] the [00:44:51] image [00:44:51] processing [00:44:52] time [00:44:53] has [00:44:55] increased [00:44:55] to [00:44:56] 30 [00:44:56] seconds [00:44:57] per [00:44:57] image [00:44:58] if [00:45:03] all [00:45:04] the [00:45:04] images [00:45:04] comes [00:45:05] together [00:45:05] also [00:45:05] we [00:45:06] will [00:45:06] not [00:45:06] be [00:45:06] bad [00:45:06] because [00:45:07] it [00:45:07] is [00:45:07] you [00:45:08] still [00:45:08] have [00:45:09] one [00:45:09] hour [00:45:09] satya [00:45:10] 25 [00:45:12] thousand [00:45:12] images [00:45:13] are [00:45:13] coming [00:45:13] in [00:45:14] the [00:45:14] same [00:45:14] second [00:45:14] but [00:45:16] still [00:45:16] you [00:45:16] have [00:45:17] one [00:45:18] hour [00:45:18] to [00:45:18] deliver [00:45:18] SLA [00:45:19] so [00:45:22] yeah [00:45:22] if [00:45:23] you [00:45:23] are [00:45:23] calculating [00:45:24] from [00:45:25] the [00:45:25] performance [00:45:25] perspective [00:45:26] definitely [00:45:28] it [00:45:28] is [00:45:28] bad [00:45:28] and [00:45:30] nobody [00:45:30] would [00:45:30] have [00:45:31] sized [00:45:31] the [00:45:31] system [00:45:32] to [00:45:33] receive [00:45:33] together [00:45:34] even [00:45:34] together [00:45:36] also [00:45:36] they [00:45:37] would [00:45:37] have [00:45:37] said [00:45:38] probably [00:45:38] 250 [00:45:39] images [00:45:39] they [00:45:41] would [00:45:42] have [00:45:42] so [00:45:42] that's [00:45:42] where [00:45:43] exactly [00:45:43] this [00:45:43] 30 [00:45:44] seconds [00:45:44] is [00:45:44] coming [00:45:44] now [00:45:47] every [00:45:48] image [00:45:48] is [00:45:49] taking [00:45:49] 30 [00:45:50] seconds [00:45:50] to [00:45:51] process [00:45:51] and [00:45:53] it [00:45:53] is [00:45:53] a [00:45:54] streaming [00:45:54] it [00:45:54] is [00:45:54] coming [00:45:55] from [00:45:55] different [00:45:55] sources [00:45:56] not [00:45:57] coming [00:45:57] together [00:45:58] but [00:45:58] you [00:45:59] are [00:45:59] receiving [00:45:59] images [00:46:00] and [00:46:00] overall [00:46:01] around [00:46:02] 25,000 [00:46:03] images [00:46:03] you [00:46:04] have [00:46:04] received [00:46:04] in the [00:46:04] last [00:46:05] one [00:46:05] hour [00:46:05] if [00:46:06] it [00:46:07] takes [00:46:07] per [00:46:07] image [00:46:08] 30 [00:46:08] seconds [00:46:08] will [00:46:10] you [00:46:10] be [00:46:10] able [00:46:10] to [00:46:10] complete [00:46:11] all [00:46:12] the [00:46:12] images [00:46:12] within [00:46:13] that [00:46:13] hour [00:46:14] itself [00:46:14] yes [00:46:17] or [00:46:18] no [00:46:18] earlier [00:46:20] it [00:46:20] was [00:46:20] so [00:46:24] what [00:46:24] will [00:46:25] be [00:46:25] your [00:46:25] concern [00:46:26] if [00:46:27] you [00:46:27] are [00:46:27] not [00:46:27] able [00:46:28] to [00:46:28] process [00:46:28] then [00:46:30] what [00:46:30] will [00:46:30] be [00:46:31] your [00:46:31] concern [00:46:31] your [00:46:34] concern [00:46:34] would [00:46:35] be [00:46:35] like [00:46:35] why [00:46:35] is [00:46:36] it [00:46:36] taking [00:46:36] 30 [00:46:37] seconds [00:46:37] now [00:46:40] what [00:46:40] are [00:46:40] all [00:46:40] the [00:46:40] reasons [00:46:43] possibly [00:46:44] it [00:46:44] could [00:46:44] be [00:46:45] what [00:46:48] do [00:46:48] you [00:46:48] think [00:46:48] what [00:46:51] will [00:46:51] you [00:46:52] look [00:46:54] at [00:46:54] first [00:46:55] missing [00:46:57] image [00:46:57] and [00:46:57] taking [00:46:57] a [00:46:58] long [00:46:58] time [00:46:58] in [00:46:58] processing [00:46:59] no [00:47:01] we [00:47:01] won't [00:47:01] miss [00:47:02] images [00:47:02] the [00:47:02] application [00:47:03] is [00:47:05] written [00:47:06] in [00:47:06] such [00:47:06] a [00:47:06] manner [00:47:06] that [00:47:07] we [00:47:07] don't [00:47:07] lose [00:47:07] images [00:47:08] that [00:47:08] is [00:47:08] stored [00:47:09] in [00:47:09] the [00:47:09] S3 [00:47:09] getting [00:47:11] from [00:47:12] S3 [00:47:12] to [00:47:12] in [00:47:12] memory [00:47:13] takes [00:47:13] some [00:47:14] time [00:47:14] that [00:47:16] is [00:47:16] one [00:47:16] possibility [00:47:17] I [00:47:17] agree [00:47:17] Satendra [00:47:18] what [00:47:19] other [00:47:20] possibilities [00:47:21] storage [00:47:25] block [00:47:25] processing [00:47:26] block [00:47:27] code [00:47:28] taking [00:47:29] long [00:47:29] time [00:47:30] transfer [00:47:32] of [00:47:32] data [00:47:32] okay [00:47:33] storage [00:47:35] block [00:47:35] if you [00:47:35] are using [00:47:36] S3 [00:47:36] the [00:47:38] probability [00:47:39] is very [00:47:40] less [00:47:40] but still [00:47:42] it is [00:47:42] possible [00:47:43] probability [00:47:44] is very [00:47:44] very [00:47:45] less [00:47:45] storage [00:47:47] block [00:47:47] because [00:47:48] S3 [00:47:49] is [00:47:49] unlimited [00:47:49] and [00:47:50] they [00:47:51] do [00:47:51] have [00:47:51] their [00:47:52] own [00:47:52] way [00:47:53] of [00:47:53] handling [00:47:53] their [00:47:54] storage [00:47:54] if [00:47:55] storage [00:47:56] is [00:47:56] the [00:47:56] blocking [00:47:56] then [00:47:57] definitely [00:47:59] we can [00:47:59] go back [00:48:00] to [00:48:00] AWS [00:48:01] second [00:48:03] is [00:48:03] processing [00:48:04] block [00:48:04] what [00:48:05] could [00:48:05] block [00:48:06] the [00:48:07] process [00:48:07] you know [00:48:08] processing [00:48:09] is going [00:48:09] to happen [00:48:10] with [00:48:10] CPU [00:48:11] and the [00:48:12] instruction [00:48:13] set is [00:48:14] going to [00:48:14] come from [00:48:15] application [00:48:16] and the [00:48:17] data is [00:48:18] going to [00:48:18] come from [00:48:19] S3 [00:48:19] at least [00:48:22] I believe [00:48:22] we are on [00:48:25] the same [00:48:25] page [00:48:26] until here [00:48:27] code [00:48:28] not being [00:48:29] parallelized [00:48:31] to account [00:48:32] for set [00:48:33] of images [00:48:34] let us [00:48:35] assume that [00:48:36] sequentially [00:48:36] only we are [00:48:37] processing [00:48:38] still the [00:48:40] 30 seconds [00:48:40] is too much [00:48:41] for us to [00:48:42] handle [00:48:43] 25,000 [00:48:43] images [00:48:44] let us [00:48:45] assume we [00:48:46] are not [00:48:46] doing [00:48:46] parallel [00:48:47] we are [00:48:48] doing [00:48:48] sequential [00:48:48] image [00:48:49] by image [00:48:49] only [00:48:50] if it [00:48:51] performs [00:48:52] at the [00:48:53] normal [00:48:53] performance [00:48:54] it should [00:48:54] happen in [00:48:55] 3 milliseconds [00:48:56] now it [00:48:56] takes 30 [00:48:57] seconds [00:48:57] so one [00:48:58] one is [00:48:59] definitely [00:49:01] processing [00:49:01] block [00:49:02] code [00:49:04] taking [00:49:05] a long [00:49:05] time [00:49:06] is [00:49:08] somehow [00:49:08] related to [00:49:09] processing [00:49:09] only [00:49:10] because the [00:49:11] instruction is [00:49:12] going to [00:49:12] come from [00:49:13] application [00:49:14] and generally [00:49:15] we will have [00:49:16] the application [00:49:16] running in the [00:49:17] same environment [00:49:18] though we may [00:49:20] have data [00:49:20] coming from [00:49:21] the remote [00:49:21] we will not [00:49:23] have CPU on a [00:49:25] different virtual [00:49:26] machine and [00:49:27] application running [00:49:28] in a different [00:49:28] virtual machine [00:49:29] generally that's not [00:49:32] the best practice [00:49:32] so the [00:49:35] instruction set [00:49:36] should come [00:49:36] fast [00:49:37] so obviously [00:49:39] the third [00:49:40] possibility is [00:49:42] data [00:49:44] now where is [00:49:51] the role of [00:49:51] RAM [00:49:52] because the [00:49:54] data has to be [00:49:54] loaded to the [00:49:55] RAM and it has [00:49:56] to be retrieved [00:49:56] from the RAM [00:49:57] it's not going to [00:49:59] be read [00:49:59] directly from [00:50:00] the application [00:50:01] is not going [00:50:01] to read it [00:50:02] directly and [00:50:03] use it directly [00:50:04] from the [00:50:04] storage [00:50:05] the intermediate [00:50:07] step is [00:50:08] memory [00:50:08] so now there [00:50:10] are two [00:50:11] possibilities [00:50:12] one is [00:50:12] memory [00:50:12] and [00:50:14] it is running [00:50:15] high [00:50:15] server overload [00:50:18] and throttling [00:50:20] Neeraj I believe [00:50:21] is related to [00:50:22] utilization [00:50:23] now what is [00:50:26] utilizing [00:50:26] if [00:50:28] RAM is [00:50:29] high utilized [00:50:30] then what is [00:50:32] it utilizing [00:50:33] then we need to [00:50:33] go back to [00:50:34] the process [00:50:34] loop [00:50:35] which process [00:50:37] is consuming [00:50:37] more memory [00:50:38] then that would [00:50:41] be related to [00:50:42] image processing [00:50:43] is it related [00:50:45] to image [00:50:45] processing or [00:50:46] is it related [00:50:47] to data [00:50:47] recognition [00:50:48] so step by [00:50:50] step we will [00:50:51] go so now [00:50:52] there are three [00:50:52] entities or three [00:50:53] resources that [00:50:54] are involved [00:50:56] one is your [00:50:56] processor [00:50:57] second is your [00:50:59] memory [00:50:59] third is your [00:51:00] storage [00:51:01] that is perfect [00:51:03] statement [00:51:04] third is [00:51:06] storage [00:51:07] but now [00:51:09] is network [00:51:11] playing the [00:51:12] role of [00:51:12] choke up [00:51:13] that may [00:51:17] not be the [00:51:17] case because [00:51:18] we are [00:51:18] assuming [00:51:19] memory [00:51:20] utilization [00:51:21] is high [00:51:22] so it [00:51:24] could be the [00:51:25] instruction set [00:51:26] could be [00:51:27] we might have [00:51:27] released the [00:51:28] application [00:51:28] yesterday [00:51:29] new application [00:51:32] or the [00:51:32] upgraded [00:51:32] application [00:51:33] maybe [00:51:35] application [00:51:35] is not [00:51:36] behaving as [00:51:38] expected [00:51:39] so now [00:51:41] four [00:51:42] things that [00:51:43] stands in [00:51:44] front of us [00:51:44] and we need [00:51:46] to rule out [00:51:47] one by one [00:51:47] we can't rule [00:51:48] out more than [00:51:49] one at a [00:51:50] time [00:51:50] that is the [00:51:52] best practice [00:51:52] so rule out [00:51:53] the fastest [00:51:54] that is [00:51:56] basically we [00:51:57] will start it [00:51:57] from CPU [00:51:58] then we [00:52:00] will go to [00:52:01] memory [00:52:02] and anyhow [00:52:04] we see [00:52:04] memory is [00:52:05] utilizing [00:52:05] high [00:52:06] then we [00:52:08] will see [00:52:08] which process [00:52:09] that process [00:52:11] is related [00:52:11] to which [00:52:13] module of [00:52:14] the application [00:52:14] so basically [00:52:17] it could be [00:52:18] loading the [00:52:18] image from [00:52:20] remote [00:52:21] possible [00:52:22] so if it [00:52:23] is loading [00:52:24] the image [00:52:24] from [00:52:25] it's taking [00:52:26] for example [00:52:28] 20 seconds [00:52:29] then still [00:52:31] 21st [00:52:31] second it [00:52:32] should have [00:52:32] completed [00:52:33] why it [00:52:33] has taken [00:52:34] another 10 [00:52:34] more seconds [00:52:35] so this is [00:52:37] how we will [00:52:37] start looking [00:52:38] at the [00:52:39] performance [00:52:40] and in my [00:52:42] experience [00:52:43] most of the [00:52:44] time [00:52:44] almost like [00:52:47] 70% of the [00:52:48] time [00:52:49] it is the [00:52:51] instruction set [00:52:52] that leads to [00:52:53] the memory [00:52:53] utilization [00:52:54] if the [00:52:57] instruction set [00:52:58] is the [00:52:58] problem [00:52:58] then CPU [00:52:59] also will [00:53:00] be in the [00:53:00] threshold [00:53:01] it will lead [00:53:03] to memory [00:53:04] threshold [00:53:04] because CPU [00:53:05] will not [00:53:06] consume the [00:53:06] data from [00:53:07] the memory [00:53:07] and it will [00:53:09] start piling it [00:53:10] up [00:53:10] now the [00:53:12] processor is [00:53:13] going to [00:53:14] continue [00:53:14] all the [00:53:16] process [00:53:17] which is [00:53:18] getting [00:53:18] instruction [00:53:21] set means [00:53:22] whatever the [00:53:22] application is [00:53:23] going to [00:53:24] tell [00:53:24] what to [00:53:27] do to [00:53:28] the CPU [00:53:28] so it [00:53:29] gets broken [00:53:30] down we saw [00:53:31] that in [00:53:31] detail [00:53:32] it gets broken [00:53:33] down creates [00:53:34] system calls [00:53:36] and then given [00:53:38] as a [00:53:38] ISA to the [00:53:39] CPU [00:53:40] and then based [00:53:42] on the [00:53:42] ISA it [00:53:43] will move [00:53:44] it will move [00:53:44] up the [00:53:44] ladder [00:53:45] it will [00:53:47] wait for [00:53:48] the processor [00:53:48] to be [00:53:49] available [00:53:49] and then in [00:53:51] the sequence [00:53:52] it will [00:53:52] happen [00:53:52] processor is [00:53:54] so fast [00:53:54] it will not [00:53:56] keep much [00:53:56] instructions [00:53:57] in the [00:53:57] queue [00:53:58] unless the [00:53:59] instruction [00:54:00] itself has [00:54:01] some issue [00:54:02] maybe we [00:54:04] are referring [00:54:05] to the [00:54:05] wrong [00:54:06] volume [00:54:07] let us [00:54:09] assume that [00:54:09] we are [00:54:09] referring to [00:54:10] the [00:54:10] wrong [00:54:10] volume [00:54:11] then your [00:54:15] number of [00:54:16] images will [00:54:16] get piled up [00:54:17] because images [00:54:18] will not get [00:54:19] processed [00:54:19] so your [00:54:21] storage will [00:54:22] have stress [00:54:23] memory also [00:54:24] will have [00:54:25] stress [00:54:25] CPU also [00:54:26] will have [00:54:27] stress [00:54:27] if it is [00:54:30] bandwidth [00:54:30] related [00:54:31] then storage [00:54:33] will not [00:54:33] have stress [00:54:34] but RAM [00:54:36] and memory [00:54:37] and processor [00:54:38] will have the [00:54:39] stress [00:54:40] if code [00:54:42] is the [00:54:42] issue [00:54:42] still [00:54:44] memory also [00:54:45] will receive [00:54:46] the stress [00:54:46] not the [00:54:47] network [00:54:48] and [00:54:48] storage [00:54:49] and then [00:54:52] we will go [00:54:52] ahead and [00:54:53] look at the [00:54:53] code [00:54:54] you modify [00:54:55] upload [00:54:56] probably it is [00:54:57] a small [00:54:58] configuration [00:54:58] wherein we [00:55:01] are allocating [00:55:01] less RAM [00:55:02] for the [00:55:02] application [00:55:04] we were [00:55:05] supposed to [00:55:06] allocate [00:55:07] 100 MP RAM [00:55:08] but we are [00:55:09] doing only [00:55:10] 1 MP RAM [00:55:10] because 0s [00:55:11] were missing [00:55:12] type of [00:55:12] error [00:55:12] in the [00:55:14] configuration [00:55:14] file [00:55:14] so once [00:55:17] you update [00:55:17] then [00:55:18] so now [00:55:19] still why [00:55:20] is it [00:55:20] showing [00:55:20] CPU [00:55:21] stressing [00:55:22] the core [00:55:24] in which [00:55:24] the [00:55:25] application [00:55:25] is [00:55:26] getting [00:55:26] processed [00:55:27] is [00:55:27] stressed [00:55:28] not the [00:55:29] overall CPU [00:55:30] but the [00:55:30] overall [00:55:30] memory [00:55:31] will get [00:55:31] stressed [00:55:32] but [00:55:36] the next [00:55:38] thing is [00:55:38] the [00:55:39] persistence [00:55:42] suppose [00:55:44] if [00:55:44] you [00:55:46] restart [00:55:47] the [00:55:47] server [00:55:47] suddenly [00:55:49] somebody [00:55:50] restarted [00:55:51] the [00:55:51] server [00:55:52] it is [00:55:55] by mistake [00:55:56] not [00:55:56] intentional [00:55:57] you [00:55:59] restart [00:55:59] the [00:56:00] server [00:56:00] then [00:56:00] obviously [00:56:01] whatever [00:56:02] was there [00:56:02] in the [00:56:03] RAM [00:56:04] that is [00:56:05] your [00:56:05] memory [00:56:06] main [00:56:06] memory [00:56:06] cache [00:56:08] unregisters [00:56:10] everything [00:56:10] is getting [00:56:11] fresh [00:56:11] it will [00:56:12] get [00:56:13] refreshed [00:56:13] but [00:56:16] whatever [00:56:16] is available [00:56:17] in your [00:56:18] storage [00:56:18] S3 [00:56:20] bucket [00:56:20] or [00:56:20] whatever [00:56:20] is [00:56:20] available [00:56:21] in your [00:56:21] local [00:56:23] hard disk [00:56:23] is [00:56:23] continued [00:56:24] to be [00:56:24] available [00:56:25] that is [00:56:27] the [00:56:27] difference [00:56:27] between [00:56:27] this [00:56:28] storage [00:56:28] and [00:56:28] all of [00:56:30] them [00:56:30] are [00:56:30] storages [00:56:31] only [00:56:31] this is [00:56:33] within [00:56:33] the [00:56:33] CPU [00:56:34] this is [00:56:35] within [00:56:36] the [00:56:36] motherboard [00:56:38] and [00:56:39] this [00:56:39] is [00:56:40] remote [00:56:40] so [00:56:44] everything [00:56:44] increases [00:56:45] the [00:56:45] capacity [00:56:46] increases [00:56:46] the [00:56:48] latency [00:56:48] increases [00:56:49] turn to [00:56:50] retrieve [00:56:51] increases [00:56:52] and also [00:56:53] cost also [00:56:54] increases [00:56:54] the cost is [00:56:56] only the [00:56:56] utilization of [00:56:57] registers and [00:56:58] cache by the [00:56:58] CPU [00:56:58] but [00:57:00] memory [00:57:01] not [00:57:03] much of [00:57:05] incremental [00:57:07] cost [00:57:08] but storage [00:57:12] each S3 [00:57:12] bucket for [00:57:13] example [00:57:13] will increase [00:57:15] the cost [00:57:15] suppose if [00:57:16] 25,000 files [00:57:18] are coming [00:57:18] every hour [00:57:19] and you are [00:57:19] able to [00:57:19] 3 [00:57:24] every time [00:57:27] then the [00:57:29] cost for [00:57:30] the S3 [00:57:30] is not [00:57:31] going to [00:57:32] increase [00:57:32] it will [00:57:33] be like [00:57:33] within [00:57:35] whatever is [00:57:36] expected [00:57:37] but if it [00:57:40] is piling [00:57:41] up [00:57:41] then that's [00:57:44] not going [00:57:45] to be [00:57:45] the case [00:57:46] so the [00:57:49] memory [00:57:49] hierarchy [00:57:50] not only [00:57:53] increases [00:57:54] or decreases [00:57:55] the speed [00:57:56] but also [00:57:58] increases [00:57:59] the cost [00:58:00] but we [00:58:03] can't do [00:58:03] because it's [00:58:05] only transactional [00:58:06] cost [00:58:06] not [00:58:08] capital [00:58:12] investment [00:58:12] but the [00:58:15] transaction cost [00:58:15] is also [00:58:16] going to [00:58:16] increase [00:58:17] substantially [00:58:20] if you are [00:58:21] going to [00:58:21] add more [00:58:22] CPUs [00:58:25] then that [00:58:28] is going [00:58:28] to add [00:58:29] the [00:58:29] operational [00:58:30] cost [00:58:30] permanently [00:58:31] though it [00:58:32] is an [00:58:32] operational [00:58:33] cost [00:58:33] every month [00:58:34] you have [00:58:34] to pay [00:58:34] for the [00:58:35] same [00:58:35] CPUs [00:58:36] that is [00:58:36] running [00:58:36] there [00:58:36] so we [00:58:39] need to [00:58:39] be aware [00:58:40] of [00:58:40] capacity [00:58:42] latency [00:58:43] and cost [00:58:44] and we [00:58:45] need to [00:58:45] balance [00:58:45] it [00:58:46] okay [00:58:48] perfectly [00:58:48] fine [00:58:48] now [00:58:50] before [00:58:53] going [00:58:53] ahead [00:58:53] and [00:58:54] understand [00:58:55] we [00:59:01] need [00:59:02] to [00:59:02] be [00:59:02] in [00:59:02] a [00:59:02] position [00:59:02] to [00:59:03] identify [00:59:03] where [00:59:04] an [00:59:04] application [00:59:04] currently [00:59:06] executing [00:59:07] local [00:59:08] variables [00:59:09] may [00:59:09] reside [00:59:09] local [00:59:11] variables [00:59:11] if you [00:59:12] have [00:59:12] written [00:59:12] it [00:59:12] in [00:59:12] the [00:59:12] application [00:59:13] is [00:59:13] expected [00:59:14] to [00:59:15] reside [00:59:15] in [00:59:15] the [00:59:15] memory [00:59:16] not [00:59:19] beyond [00:59:20] memory [00:59:21] the [00:59:26] compiler [00:59:27] and the [00:59:27] processor [00:59:28] decisions [00:59:29] determine [00:59:29] whether [00:59:32] it is [00:59:32] going to [00:59:32] be [00:59:33] residing [00:59:34] in the [00:59:34] registers [00:59:35] L1 [00:59:36] L2 [00:59:37] L3 [00:59:38] cache [00:59:38] or [00:59:38] memory [00:59:39] most [00:59:39] of the [00:59:40] time [00:59:40] it [00:59:40] will [00:59:40] be [00:59:40] there [00:59:42] is [00:59:43] no [00:59:43] simple [00:59:44] one-to-one [00:59:44] mapping [00:59:44] from [00:59:45] source [00:59:46] variable [00:59:46] to [00:59:48] a [00:59:48] fixed [00:59:48] level [00:59:48] we [00:59:49] can't [00:59:49] say [00:59:49] okay [00:59:49] the [00:59:50] local [00:59:51] variable [00:59:51] global [00:59:52] variable [00:59:53] obviously [00:59:53] it will [00:59:54] be in [00:59:54] the [00:59:55] RAM [00:59:55] because [00:59:56] the moment [00:59:57] it goes [00:59:57] into [00:59:57] the [00:59:58] registry [00:59:58] upon [00:59:59] completing [01:00:00] that [01:00:00] ISA [01:00:01] that [01:00:02] memory [01:00:02] is also [01:00:03] lost [01:00:03] the [01:00:03] variable [01:00:04] is also [01:00:04] lost [01:00:04] local [01:00:06] variable [01:00:06] can [01:00:07] reside [01:00:07] anywhere [01:00:08] between [01:00:08] register [01:00:09] to [01:00:09] SDRAM [01:00:11] but [01:00:13] the [01:00:13] global [01:00:13] variables [01:00:14] will [01:00:14] generally [01:00:14] reside [01:00:15] in the [01:00:15] SDRAM [01:00:16] not [01:00:16] even [01:00:16] in [01:00:16] L3 [01:00:17] cache [01:00:17] because [01:00:18] the [01:00:18] overall [01:00:19] ISA [01:00:19] when it [01:00:20] is [01:00:20] completed [01:00:20] this [01:00:21] gets [01:00:21] refreshed [01:00:22] but [01:00:23] your [01:00:24] SDRAM [01:00:25] will get [01:00:26] refreshed [01:00:26] only if [01:00:26] the [01:00:27] system [01:00:27] is [01:00:27] rebooted [01:00:28] so [01:00:31] one [01:00:31] way [01:00:31] of [01:00:32] looking [01:00:32] at [01:00:32] it [01:00:32] is [01:00:32] how [01:00:33] many [01:00:33] global [01:00:33] variables [01:00:34] you [01:00:34] have [01:00:34] how [01:00:34] many [01:00:35] local [01:00:36] variables [01:00:36] I am [01:00:37] just [01:00:37] giving [01:00:37] you [01:00:37] one [01:00:38] example [01:00:38] of [01:00:38] application [01:00:40] behavior [01:00:41] now [01:00:44] the [01:00:46] most [01:00:46] precision [01:00:47] is [01:00:48] the [01:00:48] local [01:00:49] hard [01:00:49] disk [01:00:49] and [01:00:50] the [01:00:50] network [01:00:50] storage [01:00:50] extend [01:00:52] the [01:00:53] broader [01:00:54] storage [01:00:54] hierarchy [01:00:55] these [01:00:57] two [01:00:57] extends [01:00:57] the [01:00:58] broader [01:00:59] storage [01:00:59] hierarchy [01:01:00] they are [01:01:01] not [01:01:02] additional [01:01:02] CPU [01:01:03] cache [01:01:03] levels [01:01:04] it has [01:01:04] nothing [01:01:05] to do [01:01:05] with [01:01:05] CPUs [01:01:07] though [01:01:07] this [01:01:08] is [01:01:08] connected [01:01:08] to [01:01:09] the [01:01:09] local [01:01:09] motherboard [01:01:10] it [01:01:11] is [01:01:11] outside [01:01:11] of [01:01:12] the [01:01:12] CPU [01:01:12] though [01:01:13] it [01:01:13] is [01:01:14] definitely [01:01:15] outside [01:01:16] of [01:01:16] the [01:01:16] network [01:01:16] itself [01:01:17] so [01:01:18] it [01:01:18] is [01:01:18] outside [01:01:18] of [01:01:18] the [01:01:18] CPU [01:01:19] so [01:01:22] before [01:01:22] we [01:01:22] get [01:01:23] to [01:01:24] understand [01:01:24] what [01:01:25] next [01:01:25] how [01:01:27] to [01:01:27] read [01:01:27] the [01:01:27] hierarchy [01:01:28] let [01:01:30] us [01:01:30] quickly [01:01:30] take [01:01:30] a [01:01:30] 5 [01:01:31] minute [01:01:31] break [01:01:32] and [01:01:34] then [01:01:34] let [01:01:34] us [01:01:34] come [01:01:34] back [01:01:34] but [01:01:34] before [01:01:35] going [01:01:36] to [01:01:36] the [01:01:37] break [01:01:37] any [01:01:39] queries [01:01:39] any [01:01:39] question [01:01:40] either [01:01:42] you [01:01:42] raise [01:01:43] your [01:01:43] hand [01:01:44] or [01:01:44] you [01:01:44] can [01:01:44] put [01:01:45] it [01:01:45] across [01:01:45] in [01:01:45] the [01:01:46] chat [01:01:46] any [01:01:48] queries [01:01:49] any [01:01:50] questions [01:01:50] I [01:02:00] do [01:02:00] not [01:02:00] see [01:02:00] anybody [01:02:02] raising [01:02:02] the [01:02:02] hand [01:02:03] and [01:02:03] okay [01:02:06] so [01:02:08] I have [01:02:08] written [01:02:08] a [01:02:09] program [01:02:10] wherein [01:02:10] I am [01:02:10] using [01:02:11] variables [01:02:11] to [01:02:13] obtain [01:02:13] the [01:02:13] values [01:02:14] so [01:02:22] now [01:02:22] within [01:02:23] the [01:02:23] variable [01:02:23] there [01:02:24] are [01:02:24] two [01:02:24] things [01:02:24] local [01:02:24] variable [01:02:25] means [01:02:25] within [01:02:26] the [01:02:26] function [01:02:26] global [01:02:28] variable [01:02:28] means [01:02:28] within [01:02:28] the [01:02:29] module [01:02:29] or [01:02:29] within [01:02:29] the [01:02:30] program [01:02:30] within [01:02:31] the [01:02:31] class [01:02:31] now [01:02:34] you [01:02:34] might [01:02:34] have [01:02:34] multiple [01:02:35] functions [01:02:36] within [01:02:36] a [01:02:36] single [01:02:37] program [01:02:37] so [01:02:38] the [01:02:38] moment [01:02:39] the [01:02:39] function [01:02:40] is [01:02:40] completed [01:02:40] the [01:02:40] local [01:02:41] variable [01:02:41] no [01:02:43] I [01:02:43] just [01:02:43] stopped [01:02:43] sharing [01:02:44] the [01:02:44] screen [01:02:44] video [01:02:45] so [01:02:47] the [01:02:48] moment [01:02:48] function [01:02:49] is [01:02:49] completed [01:02:49] the [01:02:50] local [01:02:50] variable [01:02:50] will [01:02:50] be [01:02:51] wiped [01:02:51] out [01:02:51] because [01:02:52] the [01:02:52] local [01:02:53] variables [01:02:53] generally [01:02:54] stored [01:02:54] between [01:02:55] the [01:02:56] register [01:02:57] and [01:02:57] the [01:02:57] cache [01:02:57] if [01:02:59] it [01:02:59] is [01:02:59] a [01:02:59] global [01:03:00] variable [01:03:00] generally [01:03:00] it [01:03:01] is [01:03:01] go [01:03:02] and [01:03:02] resides [01:03:02] in [01:03:02] the [01:03:02] memory [01:03:03] so [01:03:05] that [01:03:05] the [01:03:06] program [01:03:07] from [01:03:08] function [01:03:08] to [01:03:09] another [01:03:09] function [01:03:10] it [01:03:10] can [01:03:10] refer [01:03:10] the [01:03:11] current [01:03:12] value [01:03:12] of [01:03:13] the [01:03:13] variable [01:03:13] now [01:03:16] how [01:03:18] the [01:03:18] compiler [01:03:18] and [01:03:19] the [01:03:19] processor [01:03:19] determine [01:03:20] whether [01:03:20] it [01:03:21] should [01:03:22] go [01:03:22] like [01:03:22] L2 [01:03:23] L3 [01:03:23] and [01:03:23] so [01:03:25] on [01:03:25] your [01:03:27] code [01:03:28] they [01:03:31] are [01:03:31] volatile [01:03:31] krishna [01:03:32] they [01:03:34] are [01:03:35] volatile [01:03:35] memory [01:03:35] register [01:03:36] L1 [01:03:37] L2 [01:03:37] L3 [01:03:38] is [01:03:38] volatile [01:03:38] even [01:03:39] RAM [01:03:40] is [01:03:40] also [01:03:40] volatile [01:03:41] but [01:03:41] the [01:03:41] impact [01:03:42] is [01:03:42] only [01:03:42] if [01:03:42] you [01:03:42] are [01:03:43] going [01:03:43] to [01:03:43] restart [01:03:43] until [01:03:44] then [01:03:44] it [01:03:44] is [01:03:44] just [01:03:45] so [01:03:48] now [01:03:48] when [01:03:48] your [01:03:48] instruction [01:03:49] from [01:03:50] the [01:03:50] application [01:03:50] is [01:03:51] saying [01:03:51] that [01:03:51] let [01:03:53] us [01:03:54] take [01:03:54] it [01:03:54] as [01:03:54] a [01:03:54] python [01:03:55] you [01:03:55] are [01:03:55] defining [01:03:56] it [01:03:56] as [01:03:56] a [01:03:56] global [01:03:56] variable [01:03:57] the [01:03:58] instruction [01:03:59] set [01:03:59] will [01:03:59] go [01:04:00] to [01:04:01] the [01:04:01] processor [01:04:01] ISA [01:04:03] will [01:04:03] say [01:04:03] we [01:04:04] have [01:04:04] seen [01:04:05] like [01:04:05] how [01:04:05] it [01:04:06] uses [01:04:06] the [01:04:06] registers [01:04:07] how [01:04:07] it [01:04:07] goes [01:04:08] to [01:04:08] the [01:04:08] PUs [01:04:09] and [01:04:10] how [01:04:11] it [01:04:11] processes [01:04:12] the [01:04:13] instruction [01:04:14] set [01:04:14] part [01:04:15] of it [01:04:16] this [01:04:16] data [01:04:16] also [01:04:16] will [01:04:17] go [01:04:17] you [01:04:17] might [01:04:18] have [01:04:18] set [01:04:18] it [01:04:18] to [01:04:18] value [01:04:19] 0 [01:04:19] or [01:04:20] if [01:04:20] it [01:04:21] is [01:04:21] a [01:04:21] string [01:04:21] you [01:04:21] might [01:04:22] have [01:04:22] set [01:04:22] a [01:04:22] default [01:04:22] value [01:04:25] along [01:04:25] with [01:04:25] that [01:04:25] value [01:04:26] it [01:04:27] will [01:04:27] be [01:04:27] sent [01:04:27] so [01:04:29] it [01:04:29] is [01:04:30] noted [01:04:30] that [01:04:30] it [01:04:30] is [01:04:30] a [01:04:31] local [01:04:31] variable [01:04:31] if [01:04:32] you [01:04:32] don't [01:04:33] define [01:04:33] also [01:04:34] it [01:04:34] is [01:04:35] a [01:04:35] local [01:04:35] variable [01:04:36] that's [01:04:36] what [01:04:36] the [01:04:37] instruction [01:04:37] set [01:04:38] will [01:04:38] go [01:04:38] so [01:04:39] it [01:04:39] will [01:04:39] store [01:04:40] it [01:04:40] in [01:04:40] register [01:04:42] if [01:04:42] it [01:04:42] is [01:04:42] immediately [01:04:43] needed [01:04:43] otherwise [01:04:46] L2 [01:04:46] or [01:04:47] L3 [01:04:47] L2 [01:04:49] and [01:04:49] L3 [01:04:49] only [01:04:50] if [01:04:50] it [01:04:50] is [01:04:50] within [01:04:51] the [01:04:51] function [01:04:52] but [01:04:53] no [01:04:55] I'm [01:04:56] not [01:04:56] sharing [01:04:56] I [01:04:56] stopped [01:04:57] sharing [01:04:57] the [01:04:58] screen [01:04:58] so [01:05:03] if [01:05:03] it [01:05:03] is [01:05:03] within [01:05:03] the [01:05:04] function [01:05:04] and [01:05:04] within [01:05:04] the [01:05:04] program [01:05:05] but [01:05:07] defined [01:05:08] out [01:05:08] of [01:05:08] the [01:05:08] function [01:05:08] and [01:05:09] out [01:05:09] of [01:05:09] the [01:05:10] module [01:05:10] then [01:05:12] it [01:05:12] is [01:05:12] a [01:05:12] global [01:05:12] variable [01:05:13] so [01:05:14] the [01:05:14] instruction [01:05:14] set [01:05:15] will [01:05:15] go [01:05:15] okay [01:05:16] this [01:05:16] is [01:05:16] the [01:05:16] variable [01:05:17] this [01:05:18] is [01:05:18] the [01:05:18] value [01:05:18] but [01:05:18] it [01:05:19] is [01:05:19] global [01:05:19] the [01:05:20] global [01:05:20] indicates [01:05:21] the [01:05:22] processor [01:05:22] to [01:05:23] store [01:05:24] that [01:05:24] variable [01:05:24] and [01:05:25] the [01:05:25] value [01:05:25] into [01:05:26] the [01:05:26] RAM [01:05:27] not [01:05:27] in [01:05:28] cache [01:05:28] or [01:05:29] not [01:05:29] in [01:05:29] the [01:05:30] register [01:05:31] but [01:05:32] it [01:05:33] will [01:05:33] store [01:05:33] it [01:05:33] in [01:05:33] the [01:05:34] register [01:05:34] while [01:05:34] calculating [01:05:35] and [01:05:36] then [01:05:36] it [01:05:36] will [01:05:37] get [01:05:37] refreshed [01:05:37] once [01:05:38] that [01:05:38] particular [01:05:39] function [01:05:40] is [01:05:40] completed [01:05:41] even [01:05:42] though [01:05:42] it [01:05:42] is [01:05:42] a [01:05:42] global [01:05:42] variable [01:05:43] it [01:05:43] will [01:05:43] get [01:05:43] erased [01:05:44] from [01:05:44] the [01:05:44] register [01:05:46] but [01:05:47] it [01:05:47] will [01:05:47] be [01:05:47] available [01:05:47] in [01:05:48] the [01:05:48] memory [01:05:48] so [01:05:50] for [01:05:50] the [01:05:50] next [01:05:50] function [01:05:52] if [01:05:53] the [01:05:53] same [01:05:53] variable [01:05:53] is [01:05:54] being [01:05:54] used [01:05:54] for [01:05:55] comparison [01:05:56] then [01:05:58] it [01:05:58] is [01:05:58] not [01:05:58] available [01:05:59] in [01:05:59] the [01:05:59] register [01:05:59] now [01:06:02] it [01:06:03] will [01:06:03] go [01:06:03] back [01:06:03] to [01:06:03] the [01:06:03] memory [01:06:04] and [01:06:04] check [01:06:04] if [01:06:05] it [01:06:05] is [01:06:05] having [01:06:06] the [01:06:06] value [01:06:06] for [01:06:06] that [01:06:06] variable [01:06:07] if [01:06:09] total [01:06:09] program [01:06:10] compilation [01:06:10] is [01:06:11] computation [01:06:11] and [01:06:12] instruction [01:06:12] is [01:06:13] completed [01:06:13] then [01:06:15] it [01:06:15] will [01:06:15] wipe [01:06:16] out [01:06:16] the [01:06:16] global [01:06:16] variable [01:06:17] also [01:06:17] from [01:06:17] the [01:06:18] memories [01:06:18] and [01:06:21] that [01:06:21] instruction [01:06:22] we [01:06:22] normally [01:06:23] give [01:06:23] we [01:06:24] will [01:06:24] release [01:06:25] local [01:06:26] variable [01:06:27] anyhow [01:06:27] gets [01:06:28] released [01:06:28] from [01:06:28] the [01:06:28] function [01:06:29] completion [01:06:29] global [01:06:31] variable [01:06:31] as a [01:06:32] best [01:06:32] practice [01:06:33] if you [01:06:33] are a [01:06:33] developer [01:06:34] you [01:06:34] know [01:06:34] that [01:06:34] we [01:06:35] will [01:06:36] release [01:06:36] all [01:06:36] the [01:06:36] variables [01:06:37] before [01:06:37] we [01:06:38] close [01:06:38] the [01:06:38] program [01:06:39] the [01:06:41] moment [01:06:42] the [01:06:42] instruction [01:06:42] will [01:06:42] go [01:06:43] as [01:06:44] part [01:06:44] of [01:06:44] the [01:06:44] ISA [01:06:45] release [01:06:46] the [01:06:46] memory [01:06:48] for [01:06:49] this [01:06:49] variable [01:06:50] and [01:06:50] the [01:06:50] value [01:06:50] so [01:06:52] it [01:06:52] will [01:06:52] get [01:06:52] raised [01:06:53] from [01:06:53] the [01:06:53] memory [01:06:53] this [01:06:54] is [01:06:54] how [01:06:54] the [01:06:55] decision [01:06:55] is [01:06:56] made [01:06:56] a [01:06:56] decision [01:06:56] is [01:06:57] basically [01:06:58] depending [01:06:59] on [01:06:59] the [01:06:59] instruction [01:07:00] that [01:07:00] we [01:07:01] are [01:07:01] giving [01:07:01] to [01:07:01] the [01:07:02] processor [01:07:02] hope [01:07:04] you [01:07:05] are [01:07:05] on [01:07:05] the [01:07:05] same [01:07:05] page [01:07:06] any [01:07:08] other [01:07:08] queries [01:07:09] questions [01:07:09] are [01:07:20] we [01:07:20] good [01:07:20] reaction [01:07:30] that [01:07:31] would [01:07:31] help [01:07:31] I'll [01:07:32] be [01:07:32] able [01:07:33] to [01:07:33] see [01:07:33] how [01:07:33] many [01:07:33] reactions [01:07:34] would [01:07:34] have [01:07:34] come [01:07:35] okay [01:07:36] great [01:08:01] okay [01:08:01] so [01:08:02] 2842 [01:08:03] we'll [01:08:04] have [01:08:04] 7 [01:08:05] minute [01:08:05] break [01:08:06] I'm [01:08:08] sharing [01:08:08] just [01:08:09] for [01:08:09] our [01:08:10] understanding [01:08:11] because [01:08:12] later [01:08:12] we should [01:08:12] not have [01:08:13] difficulty [01:08:13] in the [01:08:14] recording [01:08:14] to [01:08:15] at least [01:08:16] you know [01:08:16] like [01:08:17] how much [01:08:18] time [01:08:19] is going [01:08:19] to be [01:08:19] spared [01:08:20] the [01:08:21] 7 [01:08:22] minutes [01:08:22] break [01:08:22] I'll [01:08:23] be [01:08:23] back [01:08:23] thank [01:08:24] you [01:08:24] guys [01:08:25] as [01:08:26] women [01:08:27] can [01:08:28] see [01:08:30] as [01:08:38] there [01:08:38] you [01:08:39] can [01:08:41] go [01:08:43] yeah [01:08:44] I [01:08:46] can [01:08:54] Thank you. [01:17:24] Hi, everyone. [01:17:54] Thank you. [01:23:54] So, [01:24:24] Thank you. [01:27:24] So, [01:27:54] Thank you. [01:28:24] So, [01:28:54] Thank you. [01:30:54] I'm, [01:31:24] Thank you. [01:31:54] So, [01:32:24] Thank you. [01:32:57] Because, [01:32:58] So, [01:33:00] Thank you. [01:33:03] So, [01:33:14] And, [01:33:16] Okay, [01:33:17] And, [01:33:21] So, [01:33:24] And, [01:33:27] And our focus is going to be mainly on CPU cache and DRAM. We will not be [01:33:39] getting into the deeper of the storage because the storage hierarchy [01:33:44] has its own way of working. It's totally different from the memory hierarchy. [01:33:50] So our focus is on the memory hierarchy and not the storage hierarchy. [01:34:01] So now is an SSD cache? Hard disk also has a cache. Is SSD cache the same thing as the L1 cache? No. [01:34:13] The CPU cache is a hardware transfer unit within the CPU cache hierarchy. [01:34:20] Now that we know why the hierarchy exists, let us look at the mechanism that keeps frequently needed [01:34:29] data. Very close to cache. Okay. Now, the locality comes into the picture. [01:34:41] The idea is to retain copies of the data that has been used recently and to fetch the data in blocks. [01:34:54] So nearby values are available too. Those fast storage structures are cache. [01:35:01] How can a CPU avoid fetching every requested value from memory? [01:35:14] What kind of data does an application tend to reuse? [01:35:18] This is something that we need to understand. What kind of data does an application tend to reuse? [01:35:30] What do you think? A couple of examples, please. Let me look at the chat. [01:35:37] Yeah, Satendra, RAM is the connecting between the storage and the memory hierarchy. [01:35:48] The question here is, I do not see any response at this point of time. So let me, [01:36:00] what kind of data does an application tend to reuse? We easily say that whatever is being reused will be kept [01:36:12] either in cache or memory because it is nearby. So it is fast and it is small. But what type of data is being used by applications in general? [01:36:34] Example, chat history in LLM applications. Loop counter. Perfect. Structure. That is also a good example. [01:36:53] Websites. What will get stored in the cache in case if you are browsing a website? [01:37:03] I understand. I understand you are referring to the information that is getting stored in your [01:37:09] local cache. Is it CPU cache or ADIS cache? [01:37:16] That is an application cache. The application will be [01:37:22] looking for some storage. Global variables. Perfect. Authentication. [01:37:28] Authentication. Authentication. Authentication once done, why is it required to reuse? [01:37:37] Because once it is done, then for the entire session you are going to [01:37:42] use the same link. The connectivity. Cookies. Where does cookies get stored? Is it getting stored in [01:37:52] memory? Or is it getting stored in the hard disk? [01:37:58] Okay. Fair enough. [01:38:02] RBAC. Rules for APIs. [01:38:06] In our cached in sessions are ready. Reduce is memory database. Yes, that is one good example. [01:38:15] User-centric data like balances in any banking application. [01:38:20] Again, if you want to clearly understand, the only question that you need to ask yourself is, [01:38:27] is that data stored in memory cache, CPU cache, or storage cache? [01:38:35] API keys. API keys. Yes, that is one good example. Frequently accessed to resources, calculations, [01:38:46] programs. Calculations and programs are going to be part of instruction set. Why it has to be stored? [01:38:56] Okay. The data store in the browse cache. Browsing cache is stored in memory or [01:39:07] hard disk. Global variables. Yes, those are used frequently in CPU cache. Tokens. Yes, possible. [01:39:16] Because it could be one great example is personally identifiable information. [01:39:28] PII. So somebody from security background will be able to map it to PII immediately. [01:39:36] PII. So for example, I have a company and I'm doing a business on my own. I started it new in the month of May. [01:39:48] PII. So the question comes to me is, do I need to register for GST? [01:39:58] Then I go and see. I've been told that unless your business is 20 lakhs per annum, you don't [01:40:06] require a GST and you don't need to charge GST. So you don't have to go for the GST registration now. [01:40:16] But when you are approaching 18 lakhs or 19 lakhs and you're going to be sure that you're going to [01:40:21] touch 20 lakhs in that particular year, you need to go for the GST registration. [01:40:26] This is the advice given. And in the month of November, I say I'm touching 19 lakhs. [01:40:32] So immediately they say, oh yeah, we need to register. Going forward, once your GST registration is [01:40:38] successful, you should start charging GST for your invoices. Now I go for GST registration. [01:40:48] As part of the GST registration, there are two things that is personally identifiable [01:40:53] information. One is that my PAN card number, permanent account number. And the second one is the other. [01:41:04] These two are very much necessary. And apart from that, as part of the process, [01:41:12] I also need to authenticate myself with OTP in relation to the other. [01:41:19] So now there are three P personally identifiable information. One is PAN, second is AADAR, [01:41:26] and the third one is the OTP. So where do you think that this information will be stored [01:41:33] by the program when I'm going to apply for GST? I have provided my PAN number. I have provided my [01:41:46] AADAR number. Since I have provided my AADAR number, the OTP came to my mobile. [01:41:53] I am giving the OTP. So three things, PAN, AADAR, and OTP. Where do you think that [01:42:00] these three values will be stored? Will it be stored in registers, cache, memory, or a disk? [01:42:12] Yes, I say cache. Pretty much it will be stored in the cache while processing [01:42:21] a disk. Why it will be stored in a disk? [01:42:25] Okay. One thing is the PII's are not supposed to be stored in any of the storage devices. [01:42:46] So with or without concern, the best practice is not to store them. [01:42:50] In our application, we removed AADAR or PII data from cache as per UIID. Yeah, that's right. [01:42:59] Satana is giving the full process. But one thing is any PII, we cannot store it [01:43:05] in the storage with or without concern. That is the best practice. So now where will it get stored? [01:43:12] When the application is generating the OTP, let us take the instance of OTP. Now the application is [01:43:22] generating the OTP. And this OTP is getting transferred via the API to my mobile and email. [01:43:30] I am supposed to do both the OTP. I am supposed to do both the OTPs, email and mobile OTP until I authenticate. [01:43:42] Where will this OTP be stored in the system? [01:43:46] Is it in register? Is it in cache? Or is it in memory? Until my input. [01:44:04] When it is generated, it will be stored in the register perfectly fine. And then it will be moved [01:44:10] to the cache only because the instruction set is completed. Now the module is completed. Where will [01:44:18] it go from the cache? It will go to the memory. Now we are not supposed to move the OTP from memory [01:44:26] to hard disk. So that means we need to hold it in the memory. So that when I am entering the OTP into [01:44:34] the website. Again, the authentication program is going to take my value, input value. And it is [01:44:43] supposed to store it against, sorry, it is supposed to compare against what it generated. Now what it [01:44:50] generated is in the memory. Now what I am typing is getting into the register. So it will refer the memory [01:45:00] because the instruction set is going to ask it to generate the OTP to be compared. So it will refer [01:45:07] to the memory, get it, compare it. And if it is successful, it is going to allow you to submit your [01:45:13] application. This is how it handles. But it will never go to database. OTPs will never go to database. [01:45:24] And that is the best practice. Even the service provider, for example, if I have a RTL account, [01:45:33] RTL mobile, even the RTL is not going to store that OTP. Once it has sent the SMS that will be erased [01:45:42] from its system. How it will get erased? The program itself will erase it from the memory once that [01:45:51] is completed. Submission is completed. So only I will hold the OTP in my message, which I can give. [01:46:04] Once it reached my mobile device, except for the memory where the application is running, [01:46:12] there also only the generated OTP will be saved. There won't be any reference [01:46:19] to what has been sent to me. So it's two different entities. Now, even in my mobile, [01:46:29] it is stored in the storage. Even in the server also, it is stored in the storage, [01:46:37] but not in hard disk or remote, but in the memory. It won't go beyond memory in the hierarchy. [01:46:45] Okay. So once I authenticated, it will be erased from the memory also. We need to ensure once the [01:46:53] authentication is successful, we need to ensure that the application is erasing it from the memory. [01:46:59] And I am also supposed to remove the OTP SMS from my mobile. I'm also supposed to delete the OTP [01:47:07] email from my mail client. So shared responsibility model. I have to delete my instance and application [01:47:18] is supposed to erase it from the memory. In message, we see OTP is valid for 10 minutes. [01:47:26] Even then, it will be kept in the memory for 10 minutes. That's all. [01:47:30] So after that, you enter the OTP after 10 minutes, you will get a message that it has expired and you [01:47:44] need to generate OTP again. So yes, it will be saved in the memory till 10 minutes in there. So now, [01:47:52] Sundar, you ask, what will happen if that server got rebooted? It will go off from the memory, [01:47:58] the generated OTP, the generated OTP which has been saved for comparison will be erased when the system [01:48:04] comes up. That's where exactly the high availability disaster recovery comes into the picture. [01:48:13] So the application will take care of it. That is up to the application architecture and the [01:48:20] infrastructure architect to decide how are they going to. So if we did not enter, [01:48:28] it will be erased from the memory. We have to regenerate. That is how it works. So at our end, [01:48:36] it is in the permanent memory of the phone and the email. But at the server end, it will be in the [01:48:47] main memory. We will lose it if the system restarts. But if you restart your mobile or if you restart your [01:48:54] desktop or the laptop, whichever device you have received your email, that's not going to wipe out [01:49:00] the OTP from your records. You will still have that SMS you can retry and then enter the OTP again. [01:49:08] But in case if the server reboots, you have to regenerate even if it is within five minutes. [01:49:14] So that is how the hierarchy, the cache memory and the locality. So locality, it is basically the local [01:49:26] storage. So how can CPU avoid waiting for RAM for every data across? Basically to keep copies of [01:49:36] recently or nearby used data in small fast memories called cache. It can save in the cache. But if there [01:49:45] is a risk of application erasing from the cache, it will move to memory and then remove it from the [01:49:51] cache. That is how it works. Okay, fine. [01:49:56] Now, we have seen what kind of data does the application reuse. Now CPU requests a value. Now the CPU requests [01:50:15] some value. The processor checks the relevant cache level. If it is there, we have a hit. [01:50:22] That means we were able to retrieve the value from the cache. It could be L1, it could be L2. [01:50:33] If it is not a hit in L1, then it will check L2. And if it is not a hit in L2, it will look at L3. [01:50:46] If L3 may contain it, it is going to retrieve and use it. [01:50:52] Only if it is absent from the relevant caches, [01:50:58] the request needs to be served from the memory. So that means the saving of the information also [01:51:07] is in the same order. It will move from the register to L1, from L1 to L2, from L2 to L3. [01:51:16] And if it has to be removed from the L3, then only it will move the data. [01:51:23] So if it is not able to fetch from memory, for example, the OTP has expired 10 minutes over. [01:51:34] Now I am entering the OTP because I received it. I have it in my mobile. Now it says that [01:51:40] your OTP expired. How? How does it know? Basically, it is not able to retrieve it from the memory. That's it. [01:51:52] As a developer, we are not going to look at, okay, what is the time generation of the [01:51:58] OTP, the time at which the OTP is generated, whether it is expired? No. [01:52:06] Instead, our logic would be, the moment a code is generated and 10 minutes is over, we will be [01:52:13] removing it from the memory. That is the best practice and optimal utilization of the memory [01:52:20] hierarchy. Once it is not able to retrieve or fetch it from the RAM or the memory, obviously, [01:52:28] it is going to say you are, even if it is 9 minutes, 36 seconds, sometimes you might have [01:52:35] experienced that. They won't say your OTP expired or something like that. Application is just going to [01:52:41] say you need to regenerate OTP and provide us a name. That's all they are going to say. But internally, [01:52:48] the moment they are not able to fetch it from the memory, they are going to say regenerate. That's it. [01:52:54] And for the application logic perspective, if it is not there in the memory, it is expired. [01:52:59] But we will not display the message, your code has expired or something like that. We will just give [01:53:06] two options, cancel, regenerate. Normally, users will regenerate and give the code immediately. [01:53:14] That's how it works. So now, this is a simplified cache lookup. [01:53:23] And all these are local, all, until memory, it is a local hierarchy. [01:53:29] So if L1 misses, but L2 hits, did we need to fetch the data from RAM 2? No. If you are able to hit at L2, [01:53:46] definitely the data is not going to be there in L3 or RAM. It will not be. The moment you hit, [01:53:52] the process stops. So the key message is missing at this level, rather than simply saying cache paste. [01:54:05] What does it mean? When we are trying to write our application logs, suppose if we are able, [01:54:14] if we are not able to fetch and we are missing the OTP, we are supposed to write this log, [01:54:22] application log, so that tomorrow if somebody wants to look at like why there are so many OTP [01:54:29] authentication misses that are happening. Maybe that is one of the monitoring counter. [01:54:36] Suppose if you are doing like 100k OTP authentication in a month, [01:54:43] how many hit at first and how many miss at first? [01:54:49] Maybe if you are seeing that 10% of the OTP authentication is being done, not being done in [01:54:57] the first instance itself. Maybe 10% is an acceptable level. But what if it is 25%, then definitely it is [01:55:05] not an acceptable level, because the user experience is going to get impacted. [01:55:12] There will be complaint from the customers that OTP authentication is [01:55:20] we have to do double, triple. But if it is only 10%, if it is only 3%, but we need to know that. [01:55:28] To know that we have to write at what level we are able to hit the, even if it is going to hit L3 to receive, [01:55:37] or fetch the OTP or memory, we know now that it is going to take longer to fetch from the memory compared to L1 or L2. [01:55:49] L3 is going to be far more time consuming. And fetching from the memory is a little bit more than the L3. [01:56:00] So again, the user experience may come, oh, the OTP authentication is slow. It is successful. [01:56:07] So we are at 2%. 98% of the OTPs are getting authenticated in the first attempt. [01:56:17] But it takes one and a half second. It takes two and a half seconds. The average we are expecting is 30 milliseconds. [01:56:28] Why is that delay? Is it the application? Is it CPU? Is it memory? Or is it an external API? [01:56:41] Because you have a dependency with the ARCLE network or J network or Y network, whatever it is, [01:56:48] telephone network. If it is related to telephone network, then you need to fix [01:56:53] that by speaking to the API vendor. So for that we need to precisely write where we are getting delayed. [01:57:03] Maybe we are able to retrieve it from L3 or memory very fast, no issues. [01:57:09] But delivery of OTP is taking that much time. So the authentication also is happening that much. [01:57:15] If that is the case, then the cache hit or the cache miss. [01:57:28] Whether you are able to get the value from the cache or whether you are able to [01:57:31] get the value from memory or you are not able to get the value at all, [01:57:36] makes a lot of difference to identify where the problem is. [01:57:39] So to do that, we will log into the application log and write very clearly from where we are getting [01:57:49] this value for the authentication. Is it L1, L2, L3 or memory? And if it is a miss means definitely [01:57:58] it is not available in the memory. If it is L2 means L1 is a miss. If you are able to fetch it from L3, [01:58:05] that means L1 and L2 is a miss. Because the CPU is going to look at register first, if not L1, [01:58:11] if not L2, if not L3, if not memory. If not, application closes. It reprocesses. So because of this, [01:58:25] the instruction set is also getting repeated and the CPU is utilizing. If you are having 25% of the [01:58:32] OTP authentication is being done in the second attempt, that means 25%, 25,000 requests [01:58:42] was additionally processed by your processor, by your system. And there is a cost involved because [01:58:51] your application is sending an OTP. You may be paying the vendor for OTP transfer. [01:58:56] So the 25,000, if it is 2%, probably 500. That is okay. Because we cannot avoid. If we can, then we [01:59:10] will bring it to 1%. That is optimization. But 25% is huge and we need to fix it immediately. Because [01:59:17] processing also is high processing cost and also transmission cost. Both are getting and storage [01:59:27] cost. In case if you are occupying the memory, double the time. Then the storage cost also, though [01:59:36] memory is the costliest storage unit of the storage hierarchy and register is the costliest unit in the [01:59:49] memory hierarchy. So we should try to avoid using the costliest unit all the time. That is the reason [01:59:57] we store our data in the storage in a volume and then retrieve it, though it is a little slow. Only for [02:00:07] processing, we will use memory. Memory comes in both hierarchy and that is the connecting unit between [02:00:14] the memory hierarchy and the storage hierarchy. So cache hit versus cache mesh. This is where we are going to [02:00:23] pass today. Sorry for taking extra five minutes. I just wanted to complete until cache hit and cache miss. [02:00:32] Any queries, any questions before we conclude our session today? Why is memory hierarchy designed around [02:00:41] the principle of locality of reference? What happens if an application does not exhibit? [02:00:46] Okay. That is application to be fixed. The impact is basically your local is being utilized higher and then [02:01:03] cost is going to be according to that. Why should I keep code for 10 minutes always? [02:01:10] No. 10 minutes validity is desired by the application. There are, suppose if you are going to the ATM [02:01:20] and if you are going to, today you have multiple ways of withdrawing money and you have another [02:01:27] process to withdraw your money is using the UPI QR code. Now I am using that UPI option. I have entered my [02:01:37] amount. From that time, from that time, if you look at the ATM, any bank, there will be a clock which will be [02:01:44] running on top right of the screen. It will start with some 75 seconds. [02:01:48] So that means you are supposed to receive the QR code. You are supposed to enter the [02:02:02] pin for confirmation of the withdrawal within 75 seconds. Once it is done, then it will say now [02:02:10] this process is going to withdraw money for you from the machine and that process will have only 60 seconds to [02:02:17] complete. In case if it is not able to withdraw the money within 60 seconds, then it is going to [02:02:24] cancel the transaction. I am not sure if any of you have experienced it. In case if you are, if you have [02:02:31] not, you can just look at the ATM. So time is not the criteria. It is what we have set the criteria [02:02:42] is the time. Okay. Is RAM can be used as a cache for persistent storage? We can use. Technically it is [02:02:54] possible again, but as a best practice it is not. Because if you start using for persistent storage cache [02:03:02] the memory, then whatever the program requires the memory, it will not be available for you. [02:03:10] So that's the reason even the browsing cache is stored in the hard disk, not in the memory in your laptop. [02:03:18] If you are clearing up your browsing history, then you can see hard disk will blink. So it is clearing it [02:03:25] off from the hard disk. So whenever you are trying to access your browsing history, it is going to load from your [02:03:32] local hard disk. So it uses the hard disk as a storage and not memory as a storage. [02:03:40] It is not a best practice. Can I? Yes, you can, but it is a costly affair. [02:03:46] Any other queries? Questions from anyone? [02:03:49] Okay, guys. Thank you very much. We will catch up at two o'clock tomorrow. [02:03:58] We will continue with this and we will see some demonstrations of how to observe it. Take care. Bye-bye. [02:04:10] Bye-bye.