Hello everybody! This video will show you how to enable, disable and set up sleep in Windows, and what to do if the computer refuses to wake from sleep or if sleep doesn't work. Dear friends, if you need to recover deleted data, use utilities by Hetman Software. Follow the link in the description to visit our website, download a utility for free and install it, then start disk analysis. When the process is over, it will show the files available for recovery, and you will be able to bring them back. Our blog features quick guides to solve all kinds of problems faced by Windows users. Our channeling blog offers solutions for any issues from installing the operating system to remote administration and connecting mobile devices. Our specialists will be glad to answer your questions in comments to videos and articles. In sleep mode, the computer doesn't shut down. Sleep is characterized by less power consumption than in inactive mode. Some components are powered off, such as the hard disk, while others switch to power-saving mode. All applications which are running are kept in the system memory. They are working but in a waiting mode. You can continue work from sleep mode very quickly. Your computer will be ready for work again in a matter of seconds. You can set up or disable sleep in Windows 10, both in the new settings interface and in the traditional control panel. To do it, go to the menu Settings, System, Power and Sleep. This is where you can set the time when the computer's screen should be powered off if the computer is not in use. You can also set the time when the computer goes to sleep mode when you are not using it. You can even disable this function by selecting Never instead of a time period. You can also modify sleep settings from the control panel, which is found in all versions of Windows. To do it, go to control panel. And in one of the previous videos I have already shown you how to open control panel. You will find a link in the description. Set the view options to large or small icons, select power options, click on Change when the computer sleeps, link on the left side. This is where you can set the time when the computer goes to sleep mode when you are not using it. You can even disable this function by selecting Never instead of a time period. By selecting Change Advanced Power Settings, you can find you in Power Management and Sleep mode options. They include the time when hard disk is turned off when idle, options for hibernation or hybrid sleep. Hibernation mode was developed especially for laptops, where battery life and quick returning to work are very important. When hibernation mode is on, all running applications from the system memory are saved to a separate file in the computer's hard disk – hyperfile sys. And the computer shuts down. You can get back to work slower than after sleep mode, but quicker than after usual Windows boot. All running applications and open windows will be restored. A hybrid sleep will be more useful for desktop systems and areas with unreliable power supply network. It combines the advantages of sleep mode and hibernation. Running applications are saved both to system memory and the hard disk. The computer needs less energy. The computer will be able to wake up in the proper condition even if there was a power failure, as the rule this option is enabled for desktop computers. Allow wake timers Enabling this function allows waking the computer from sleep for other applications, antiviruses, network activity and even updates, if Windows is set up to update at a certain time. Power buttons and lead This is where you decide what the computer does when you press the power button or close the laptop's lead, and so on. I will not go into detail of all additional settings just because it is not necessary to change them too much. It can even make things worse. Anyway, if there are problems with sleep mode options, you can always go back to default settings by clicking the corresponding button. If you ever worked with sleep mode, you know that the computer can be woken up by clicking the mouse button or pressing any button on the keyboard. If you need to disable or enable this function, this is what you should do. Go to Device Manager There are many ways, but this one is good for all cases. Open this PC, select System Properties, Device Manager, select Mice and other point-in devices. Right-click on HID-compatible mouse, this is your mouse, Properties, Power Management, and set the option Allow this device to wake this computer the way you want it. You can also make similar settings for the keyboard. Keyboards, HID keyboard device, Right-click, Properties, Power Management, Allow this device to wake the computer. Often users face the problem when the computer can't return from sleep. In many cases, it happens because in the settings the boxes allowing the keyboard and the mouse to wake the computer are not checked. In this case, try waking the computer from sleep by quickly pressing the Power button. If the computer refuses to go to sleep, go to Control Panel, Power Options, change when the computer sleeps, change Advanced Power Settings, find Sleep, Allow wake timers, and set it to Disable. As I said before, enabling this function allows waking the computer from sleep for other applications, antiviruses, network activity, and even updates. If some application is active or running on Skittle, it can prevent the computer from going to sleep. The other reason why the computer refuses to go to sleep can be the mouse or the keyboard. To see if the mouse or the keyboard caused this problem, disable the option to wake computer from sleep for one of them at a time. Then check if the PC can go to sleep. One of the devices may be active for some reason, or still stay in touch with the computer. You can have a blocked pattern, some dirt inside it, low quality over and out mouse mat, etc., and so the computer can't go to sleep. But make sure that you don't disable this option for both the mouse and the keyboard at the same time. Take turns to check each of them. If you don't do it this way, there may be problems with waking the computer. You can also use Command Prompt to see what application or process prevent the computer from going to sleep. In one of our previous videos I have already shown you how to open Command Prompt, so you will find the link in the description. To do it, just start Command Prompt and enter the command power cfg space slash requests. You will see the processes that can keep the computer from sleeping, which you can end. That is all for now. It seems I have told you even more than necessary on this topic. However, if you have any other questions about Windows sleep mode, don't be shy to ask, and we will find a solution. If you liked this video, hit the Like button below and subscribe to our channel.


Hello and welcome back to yet another GCSE revision lesson now with just less than three days to go before the English language paper one exam. What I wanted to offer you guys in this lesson is a really effective way to approach question number five in the language paper one exam. Now I would say that this is arguably the hardest part of the exam to prepare for and it carries the most marks okay. So the stakes are quite high when it comes to the creative writing portion of your exam. Now if you're feeling a little bit overwhelmed because you've only got the weekend before the exams start how can you approach this in the most strategic way. My suggestion is number one go for the story as opposed to descriptive writing only because when it comes to storytelling you can start off in one place and then end in somewhere else.  So the first way I would suggest effectively preparing for this portion of the exam go for the story. Also secondly when you go for the story make sure you have some story plans memorized which can be flexible enough and that can give you the room to answer any questions that could come up. So as you can see behind me I have selected five different story plans covering different genres, different settings that you should consider and potentially use as part of your upcoming exams. So what I want to walk you guys through are these story plans and what you could write for each story plan using the story mountain structure with the beginning build up problem resolution and ending. So beginning with the first story and this is in a city setting so this could be a thriller that you could write. So let's say you decide or you get a question that tells you to write something that is based in a city landscape. This story perhaps you could use. So you can start off beginning by describing how you as a protagonist are cycling home and weaving through the busy city streets, so maybe you're in London and you're weaving through one of the busiest streets within London and you're very keen to get home. Now when you look at the weather perhaps it's sunny, it's really beautiful, there's a sense of promise.   So you decide to take a detour, cut through the side streets and then you now start even moving faster and cycling quicker towards home. So now you're in the more silent, labyrinth streets so you can even describe the city as almost amazed. However in your problem paragraph you then realise that there's a rickety sound behind you. You gaze back and realise that there's an old man, maybe he looks very shabby and he's on a rickety bicycle and he's literally peering at you and almost chasing you. So of course you look at him, your heart starts racing and you start pedaling away faster and faster. Then in your resolution paragraph you decide to cut through more side streets in order to try and weave away from him.  That's your resolution and then your ending paragraph is now this person on this rickety bike slams into your bike.  You could end by asking a rhetorical question, is this the end? That's the first story plan. Now the second story could be maybe based on a beach and maybe this could be a rescue story. So when it comes to this story, maybe you could begin again using Pathetic Fallacy, positive Pathetic Fallacy to establish a sense of hope and optimising by saying that it's a really, really nice barmy day. It's sunshine, the sun is shining down, gilding everything around you with maybe a hazy golden mist. So you're sitting by the shore in this beautiful sun and really enjoying and taking in the barmy sunny day. You're perhaps looking out onto the ocean and really enjoying the view and it's holiday time after such a busy period. You're just really happy to have time to yourself. Now in your build-up paragraph, maybe your eyes are drawn to the ocean and a specific surfer and perhaps they have a very distinctive surfboard. Maybe they have a scarlet or ruby red surfboard and you admire them as they ride in the waves of the ocean. However, the problem, and this is now the rescue aspect, is a wall of water could rise up and then suddenly the surfer disappears under that wall of water, your heart starts racing. OK, so your heart is always racing in the problem paragraph as you look around and you realise that there's no lifeguard in sight. Resolution is you could run towards the windy crashing waves of water. So now it's gone from being quite sunny to still sunny, but maybe very windy, right? The wind is beating back against you and you're rushing into the water. You plunge yourself into the water and you go towards the scarlet or the ruby red surfboard, which is still bobbing up on the water.  Maybe the body feels like a rock as you swim back towards the shore because you have rescued this person. OK, that's the second story idea. Now, the third, which you could let's say, for example, you wanted to write a story that conveys some kind of secret or some kind of discovery or even the person that uncovers the secret realises that they're an outsider. This is what you could write about. So in this case, unlike the first two stories, you can use pathetic fallacy to already establish a sense of darkness. OK, so you could begin by describing how it's raining and you're outside your grandmother's cottage, standing at the front door, feeling quite heavy, OK? And perhaps you're feeling heavy in your heart because your grandmother has passed away and you're there to pack away her belongings maybe before selling your parents at your grandmother's grandmother's cottage. OK, that's the beginning paragraph.   So you describe what you can see in the sitting room. Maybe you can see her wheelchair or her rocking chair even. Maybe you can see like a table. You start reminiscing on all of these things as you walk in through the front room. You walk in through the kitchen, you're going up the stairs and you're describing what you can see in your grandmother's cottage. Now, what is the problem? The problem could be your heart sinks as you realise that you're unsure as what you need to pack first. OK, so you your heart sinks as you're unsure what to pack away and you feel very overwhelmed. Now, how do you resolve this problem as you're looking around? Once more, your palms are getting sweaty. You're feeling as if maybe your heart is sinking to the pit of your stomach. Resolution could be you decide to go to the loft. OK, so you decide I'm going to go to the loft because there's lots of things in the loft I can kind of get used to packing them away before I look at other areas of the house. And you climb up the loft and find this mysterious chest of drawers. Perhaps they have lots of dust on them. And you're curious to see what's inside these chest of drawers.  Open the drawers, right? So maybe the the locked but the locks are rusty and eventually you force it open and this these sheets and so on come flying out. OK, so like a shower of papers all come flying out.  So you're an outsider because you actually were never biologically connected to your family. And that was a massive secret. OK, that's story number three. Story number four, this could be a horror inspired story. So let's say you want to go for like a little bit of a scary story. This is what you could write about. So your beginning paragraph, perhaps you can base it in October or November, write a dark dismal day. Even a dark dismal night to create the sense of terror, maybe the sense of foreboding.  And you're holding Halloween treats in your hands and you're really panicking because you don't want to do this. So maybe your reader is reading this and thinking, what do you want to do? Then your second paragraph, your buildup paragraph is we learned that your friend is upset because you don't want to go through with this day whilst she went through with her day. OK, so she's upset because she knocked on a terrifying stranger's door. And now it's your turn to enter this abandoned mansion, walk through it and then come out because that's part of the dare game. So you turn in the buildup to enter this abandoned derelict run down mansion. Problem paragraph. So as you enter your heart races, as you push the door in and you enter this vast front room, maybe you look up, you see this chandelier, which is maybe having light bulbs missing. You look across, you see windows with window panes missing. You walk through your heart is racing. Your palms are sweaty and moist, OK? You're walking through. This is part of the day and you're really terrified. Then resolution paragraph is you suddenly as you're entering, perhaps maybe the kitchen, you suddenly see a dark shadow quickly pass you or flip past you. And that's when you decide to turn and run. However, how does it end? This could be your cliffhanger.   That could be a horror story plan. Fifth and final paragraph, where you can maybe juxtapose a paradise with something terrible that happens in this paradise is where you can have, say, for example, a beach setting. Or to be honest, you can even substitute beach setting with a forest setting with a cave setting, whatever any place. That's like really beautiful, very scenic. Again, you're on holiday, but now there's a complete plot twist by the end. OK, so this paradise turns into this horrific place. Now, in this case, I've decided to go for a beach. OK, so the beginning could be once more. It's really nice. It's really sunny. It's quite beautiful. And you are really excited to be in this beach paradise for holiday. And as you saunter and wander around on the beach, right, so maybe you're walking on the white sand, you're looking around, you're looking at the sky, it's an endless turquoise blue. You're looking at the ocean across. You start to notice something interesting. OK, so now this is the build up. So you're walking along the coastline and you notice a dense thicket of trees. So you notice this dense clump of trees on this forest. It's the kind of this random jungle in the corner.  OK, so that's the build up. Now, the problem could be that you decide to venture away from this noisy coast into the darkness of and into the silence of this dense jungle. OK, it's still sunny, it's not become dark, but perhaps because there's lots of trees, it's become quite shady. OK, so it's lots of shade and kind of a little bit of darkness there. OK, so as you venture further from the noisy coast and into the gloomy dense forest, you notice decaying trees. You can even notice a decaying carpet of leaves on the ground. And you start being curious as to what's going on in this part of the forest. Now your resolution is when it gets even more scary, right? So you notice a gigantic fallen palm tree with insects crawling out of it. Right, that can be your motif. Maybe it could foreshadow a dead body because in your ending paragraph, which can be the cliffhanger, you decide that you want to leave. You maybe take several steps back from this tree and you suddenly step on a human skeleton's head, right?  OK, and that could be a contrast, this paradise that turns into this horrific place. So that's really it when it comes to creative writing and the different ideas that you could incorporate into your story when you sit in this exam on Monday. Thanks so much for listening.


Next up we have Konstantin, he is a co-founder of Travis CI and he's going to talk about how he replays salary negotiations with the Sinatra app. Personally, I like apps that does this so we don't have to exercise our developer skills, our social skills. Hello, can you hear me? Yes, this is exactly the motivation behind replacing salary negotiations with the Sinatra app. I also really hate calling people and if there's a ... Anyway, I'm Konstantin, Konstantin Haase on Twitter or RKH Popcorn, these are two of my many Twitter accounts, just RKH on GitHub if you want to, I don't know, tweet at me. Anyway, let me be the first to welcome you all to Singapore. I'm happy to be back and I'm giving a talk. This is the first time I'm giving a really ... I talk about this topic and an important thing about this topic is I have actually no clue. I'm probably one of the least qualified people. I have no real experience as an employee from the salary discussion standpoint and so on. This is actually ... I don't want to say this is a non-technical talk because I actually think it's just ... This is a very technical talk. There will even be code. I promise there will be code in these slides, obviously when talking about salary. Who was here yesterday for Joe's talk, the lightning talk? Yes, so that actually said that salary isn't that important, so this talk did not say that salary isn't that important, it said it's not the reason that people leave. I also think that this talk that I'm giving is not so much about salary but more about development and leadership or rather how we do things at Travis. I think it's an important aspect of that is that I'm trying to break a taboo here, a taboo that people have been breaking previously, very famously with the talk pay hashtag and some news articles and blog posts lately. It is a great taboo to talk about salaries. I don't know how it is in Singapore, I know in Europe and in the US it's not something people generally talk about with their friends, with their colleagues, but it's not just that, it's also not companies, companies I found don't really talk about salaries either. I mentioned there was the talk pay hashtag where people were tweeting their salaries, their job, some details and that gave a lot of momentum to having a conversation about salaries. There's also bots that do that anonymously so you don't need to reveal your salary and there are some companies, a very small number that are aggressively open about their salary structure, most well known probably Buffer who have published their salary formula and not just their formula, they've actually published a complete list with names and everything of all their employees and the salaries they're paying. Buffer also is trying to be a very, very open company about this which is quite impressive. So recently they saw themselves forced to let people go because they couldn't afford from their budget anymore to pay that many salaries which also brings us to one important aspect of this presentation which is looking at salaries from the employer side as well as just what people are making which actually is the side that as a co-founder at Travis I've had to deal with more often than the other side. Well we're actually in a salary and I think that's where one of the major conflicts between employees and employers comes from or the major friction points or interpretation differences is the different view and interpretation of what the meaning of a salary is. Who knows these people? Yes? Yes? Is that a big thing here? In theory? So that's interesting. Let's talk about their salaries. Does anyone know what they make and how they're paid? A lot? Yes? Correct. No, not correct, depends on who you talk about of these five. So they all renegotiated their salaries last year, initially the three main actors renegotiated their salaries to one million per episode. So how do you pronounce it? Gallic Parsons and Cucko playing Lennart Hofstadter, Sheldon Cooper and Penny, last name unknown or at least I don't know, got a deal of one million per episode in August 2015 at a time where Helberg playing Howard Wolowitz and Kunal Nayar playing Rajish were getting paid 100,000 per episode which caused the two to try to renegotiate their salaries and they were aiming for getting salary parity with the other three which was denied to them. They got a raise which is undisclosed at this point which is supposed to be in the mid-six digits but essentially the salary negotiation ended with the studios threatening to write them out of the series. And this makes you wonder, what does this mean? Does this mean that one's a 10x actor? This is a phrase from a very popular especially in the Bay Area, this concept of the 10x developer and this comes from a strong belief in an actually misused word in that context I think, the belief in meritocracy that merit defines your standing in an organization. This rock actually has been changed for one that believes in collaboration so I didn't want to do GitHub shaming or anything but in the Bay Area there is as I said this strong belief in the 10x developer core is a great resource in general on such topics. If you want to learn the difference between a full stack 10x generalist and unicorn programmer there are other like if on this topic 10x engineers there are the really great questions like what do mediocre people do in Silicon Valley, you've got to wonder. Some of the questions are why are the best programmers ten times more productive than mediocre programmers but paid only three times as much. Another interesting question very interesting to me as well is how do bootstrap companies hire talent. I've actually once was asked by someone in a bar like you didn't take VC how do you pay salaries? Anyway nothing against VC just saying there are bootstrap companies and they do pay salaries. I actually work for one of these I actually founded I'm a co-founder of one of these bootstrap companies who here has heard of Travis CI. We bootstrapped found it in 2012 we have 38 employees at the moment that was my last count from Slack this morning. I think we have some top talent we're based in Berlin Germany but we're actually a or try to be a remote first company so we have employees in eight countries of 16 different nationalities also again I tried to count it this morning there might be something of other interesting things to give you a feel we have a 54% women in our company in our engineering team it's 50% it's a one-to-one split with a very wide range of backgrounds and we're actually planning to keep hiring in the future and salaries is an important topic for us from the company perspective salaries currently account for 46% of our spending I think in most companies it's actually higher at least most software companies but our infrastructure costs are also very massive but that on its own makes it the biggest cost center if you just look at it from a budgeting standpoint so any conversation that we have there even if it's just changing it by a small percentage has a big impact on our company finances salaries have actually for a long time been quite a mess at Travis to be honest we started bootstrap we started with not essentially having any money and we started hiring in Europe and specifically mostly in Berlin which by Western standards is a really cheap city and salary was based on so what do you need and that has actually led to once we started hiring overseas for instance a very uneven not well thought out distribution and you essentially got a raise when you said oh money is really tight I need more money but no one ever went like oh you've been here so long great work so we've been having a discussion for quite a while in the company on how to change that and we came to the conclusion and the result is that we got rid of salary negotiations at Travis CI if you want to work at Travis CI if you're going for a job interview we do not negotiate salaries with you instead we have a Sinatra app that will tell us how much we'll pay you why do we believe before I tell you more about this app why do we why are we trying to to get rid of why have we removed negotiations from this process well we think that negotiation skills don't reflect your value to the company which is the employer's approach to to how you decide on salaries if you remember that the three main characters where one point at a salary that was ten times the salary of the other main characters in the Big Bang Theory that was not based on them being ten times better actors this was based on them being ten times more valuable to the production of the show so your negotiation skills are not the main value you provide to the company unless of course you're hired as a negotiator then that's that's a different discussion the employees view on salaries different it's not it can be the value argument can be used in a negotiation or in figuring out if it's appropriate but the employees view is usually in financial needs base and your negotiation skills also don't reflect your financial needs but most importantly as one of our core values at Travis we care about creating a diverse and welcoming working space and we believe that salary negotiations harm underrepresented groups there is lots of evidence for this for instance women people of color generally under represented groups often are impacted from things like imposter syndrome there has been a study for when women and men look at a job at and their five requirements listed and for women one of the most common approaches is like I'm not so sure about this one requirement I'm really bad at this I probably am not a good fit for this up and most men approach it with oh yeah I check of three of the five I can totally do this this is not any individual person this is just a general thing that is more dominant in under represented groups and there's also statistical data to prove the whole thing salary negotiations are very likely to cause pay gaps within your company so these are some of the things we wanted to tackle and we've been working on this for over a year and we call it the Travis CI salary framework we finally rolled out release it this March company internally and this here is the very first time we're actually talking about this publicly so all the things I'm telling you are not really known outside of Travis let's first look at how again how other companies have solved this buffer also has an app I don't actually know if that's Sinatra or not their approach is very very formula based we also have a formula but I get to that in a second you can actually access their app publicly can go to buffer.com slash salary and then you can select role experience location and it will tell you exactly what you would make when you were to join a buffer but let's get back to our our framework so buffer was a big source of inspiration and figuring these out because they also have public explanations of all the things so we developed this framework for a full year and very importantly to how we are Travis approach these things this is a conversation that everyone in the company could take part in so a lot of this was actually discussing aspects of what is a fair salary for instance or what should be in a salary so we decided that we want to pay by value and we want to pay by needs by needs so we want to take both these aspects into account and we also want to come up with generalized rules that apply to everyone and that also everyone could question so in a way you can negotiate salaries but you cannot negotiate your salary you can as an employee at Travis CI say I think this pay difference is too big or we should in general pay higher salaries and then you can give a proper reasoning or we should our increase our salaries because the euro is taking a nose dive because the UK is leaving the EU or something like that but you can say I like to make 500 bucks more month that's not an argument you can use that's a screenshot of our app this is confidential you're the first people seeing this outside of the company let's talk about what goes into this are people taking photos this is being recorded so let's talk about value how do you measure value or how do you quantify what someone provides to the company buffer does that with a factor so they say you have an experience factor of 1.6 or something that is something we we started off with with playing with that but we found really hard to what does that actually mean and then everyone talks about senior developers but senior is such an overloaded term in the industry where there again is a massive mismatch between employers and employees similar to what does a 10x developer actually mean so we instead decided to take an approach where we have levels and then on these levels we have certain expectations that are quite meta that when we have an employee at a certain level we expect them to fulfill these expectations one way or another so if you had the discussion how do you define a 10x developer if they even exist I don't really know how you place them on our levels but let's just pick a level let's pick the the level 10 of our software engineering career path and that has expectation like shows an intuitive grasp of situations analytic approach only use another situations which is basically you see a problem you already know how to fix it without having to analyze all these things it's self-motivated to the point that they create new work for themselves and sometimes others and understands business requirements does not just understand but also shape the big picture so these are very vague and then you're supposed to work with your team lead at Travis CI on a regular basis mostly through one-on-ones setting specific goals for yourself to fulfill and reach the point where these are expectations the company can have to work through we currently have our engineering career path defined up to level 17 we do not have anyone at level 17 the main intention is to show people that there is room to grow while at the same time staying a software engineer and staying at Travis CI because this is actually one thing we see happening in the industry so much that people reach this point where they're senior developer and them what I guess not just about salary this is actually about your professional growth career development and so on and not just about your bank account statement and then you often see one of two things happen either people go to a different company to do something new and fun or people become managers and in both cases you lose your best developers in one case you might swap them out for potentially a bad manager if someone wants to be a manager like I'm not I don't want a bad mouth developers becoming managers like if someone is really passionate about that sure but becoming a manager because it's the next logical step in your career path is a really really bad reason and these levels we've constructed or try to phrase them in a way that employees should level up about once a year so that it's also clear how often people can expect salary raises and most importantly we don't view this as a performance review that you get once a year that we can use to justify to not give people a raise but instead as a program for us to grow people internally if someone does not meet the expectations for the next level that needs an investigation of what's going on is this some productivity issue do we have other problems here that we need to address or are our expectations wrong you do not fix productivity issues by paying people less the other aspect we take into account is needs we use a generalized needs model based on location this was actually a discussion initially where we assume the bigger discussion would be should you pay by location or should you not pay by location actually the opinion at Travis was pretty unanimously that you should pay by location the bigger question was how do you determine that those differences but essentially even if we wanted to not pay by location just pay everyone on level 10 no matter where there are the same salary we could either not afford that or we couldn't hire in California essentially but then we have the goal had the goal that if we pay by location differences we want to be scientific about this we want to be reasonable about this and we don't want to have someone basically get a worse deal because they're in a cheap or an expensive location we don't just want to pay people in San Francisco more than everyone else essentially so how do you do that there's one interesting statistic that's a Big Mac index has anyone heard about the Big Mac index so Big Mac is a great thing because it's in so many countries and it's essentially the same supply chain but it's different cost so you can compare countries based on what the Big Mac costs we do not use this for salary determination by the way it's also it's a bit unfair to have India in there actually because it's chicken meat in India which has a different cost associated there is different conclusions you can draw from this like Big Macs are the most expensive in Switzerland but that doesn't tell you actually much about Switzerland because of your then compare that to or Norway for instance it's the second most expensive it's the cheapest in South Africa but if you compare it to how long it actually takes an average worker to work to get the money for a Big Mac you see that Switzerland is still pretty good and actually Hong Kong is the best way it takes on average 8.7 minutes of work to get a Big Mac whereas in Ukraine in Kiev Ukraine you have to work for almost an hour there actually way better statistics to reason about costs of living one of my favorite is Numbeo which is actually something that we used so we use Numbeo we use the international labor organization we use the Bureau of Labor Statistics and we use shadow stats which is basically going like are those Bureau of Labor statistics statistics aren't actually that great to look at this Numbeo is actually a crowd sourced database that gives you very detailed insight into into living costs for instance for Singapore it uses 6,300 something entries you can see what a McDonald's meal costs as well but also this possible income rent and so on when I when we started investigating I built a little web app where you can basically enter which city you live in where you want to move how much you make and then you can calculate which salary you should aim for when you move there it doesn't work well for Singapore because that data on there is outdated and some models in there are outdated but works quite well if you want to move from San Francisco to Berlin or the other way so say you make 130k in San Francisco means you should aim for somewhere below 60k euros in Berlin if you want to keep the same standard of living that's living costs but also market rates are a big factor as well there there are some websites like Glassdoor where people can can enter their salaries and then it can give you an overview of a location pay scale is similar also really nice to know they have like 5th and 95th percent or I've actually think I think this is 10th and 90th percentile and pay scale has it as well for the US thanks to the open government campaign under the Obama administration you can actually just access the data from all the visa applications so you know what people are getting paid when they get a visa for the US or a green card important here is that you only compare data points from the same source because the visa data points for instance tend to be on the high end of the salary spectrum so you shouldn't use that data paid point on its own but you can use it quite well to compare to cities and the same is true for Glassdoor and pay scale where salaries at least in the US where I can compare it to other sources are more on the lower end so I use that I did a factor that's a comparison between Berlin and that city and created a splatograph of the biggest cities in the world to see a correlation between market rates mark this is market rates compared to Berlin and this is living costs compared to Berlin and you actually see that almost all the cities are in a very nice line you also see that Singapore is quite the outlier so living costs are significantly higher here than in Berlin but salaries are not proportionally higher as well and then besides that what we took into account is I think I'm running bad on time so what we also said or what was more like the conversation went like this so if we take living costs into account and rent and all these things shouldn't we take income tax into account and the conclusion was yes we should but you can't really calculate the income tax for everywhere in the world and then okay that's right and then I spent a weekend playing with some ruby code and turns out you can calculate the living car the income tax for everywhere in the world I created a ruby library you can gem install income tax you can tell it which country you're in it doesn't do tax deductions or anything even though someone emailed me and they want to do like a tax filing program for you I don't know I think they actually never got back to them anyway so you can tell it how much you make or a salary a country and we'll tell you what gross income net income taxes and important for us you can also tell it a net income like the income after taxes and it will give you a gross income interesting things I learned there in Mali you can choose your tax rate basically you go to negotiate your taxes and they go like so we want to pay 3% you want to pay 30% you can also bring a goat and use that as your tax payment and from that we calculate the the salary levels we have a baseline per country that's based on market rates and then a city adjustment for expensive cities that's based on living costs so we do take market rates into account for the US but we don't take market market rates into account for San Francisco but we do take into account that the rent is really high in San Francisco here's actually the code I promise code there's the others it's been cut off the result basically the rounded we have our own rounding method to be more favorable to our employees so it's Texas applied on top of the before taxes we apply of someone's working part-time before Texas is a monthly value times 12 monthly is the the base value plus the increase for the level you're at times the level plus the city adjustment exchange to the local currency yep that's essentially it if we would pay less than zero we just pay zero we don't make people pay and with that we've actually calculated the rates for 3,536 cities in 209 countries for four of these countries we also have 92 regions you might wonder 209 countries there aren't that many countries I recommend to you this YouTube channel I also found myself in that income tax gem to for the first time specify what this gem sees as a country and stating that this is not a political opinion but just trying to model income tax best currencies are very tricky employees that are not in the US or Germany can pick their own currency we have conference allowance converted to the currencies I imported a set a list of currencies with exchange values which I didn't know when importing this currency list included gold so if you work at Travis CI and we pay you in gold you get 4.45 ounces of conference allowance per year I assume this is how you go home and we've wrote this out with you said for all our new hires for to replace salary negotiations we're very happy with it it reflects what we set out to solve we think the rates that come out are competitive based so there are some relation to market rates they're comfortable we think people can live of them they're fair this is has to do with the rules applying to everyone for instance they're feasible they're within the capabilities of our company and their prospective so people know there is a path to take and most importantly I think it's a model that everyone participated in and can participate in shaping how that develops in the future thanks if I don't know if there's time now otherwise hit me up later or treated me email me I also brought stickers thank you Constantine I have no calls about my salary but I absolutely love what you guys are doing at Travis so round of applause and maybe you can set one question can you hear me yep yeah what's your plan for bringing existing employees across to this have you done it or is it going to be a gradual thing so we actually started doing that so we've brought on so all of our engineering team I think is now on the framework so we have this concept of people being on the framework and people being off the framework we started rolling that out we don't have all the career paths done so we have the career paths done for software engineers designers support we're working on our administration career paths right now so that's why not everyone is on this now but the majority of Travis CI is paid in accordance to the salary framework yes so we've actually discussed this releasing this public first of all we want to actually talk more about this blog about this not just to like show off what we did but also to get a conversation started that goes further than just Travis we still need to figure out what work needs to be done so that we can actually release our app which would probably also be quite interesting for people outside yes so this is where do I have to slide currencies are tricky so what we actually have is we have a Travis CI exchange rate which means we picked a change rate at certain points in time and decided that that's the exchange rate we use for the calculation these exchange rates are usually paid at times that are favorable to the person paid in this currency we also update this but this is a semi manual process so we decide to be up the change rate and the reasons there might be extreme changes or we actually plan to review this on approximately every basis if someone thinks the exchange rate is they can go to the currency page in our salary active discuss which will automatically be able to be existing issue about the currency or credit you want and then mention that it's not enough labor what we've also did is that why of course I briefly mentioned people who might be able to choose their currency so we have employees that are not getting paid and what the local currency is and the main reason for choosing that is we have an employee in Mexico the Mexican case so it's really unstable so she chose to get paid in euros instead so that's one approach we also take there. One last short question. Hello okay I have a question that is easy to actually work in business order because I also face some sense for example we have a project that mostly simple we have a project that is the tax rate of different countries in front and the exchange constantly during the rule of the government and I got the application that exchange the tax form every three months for Europe country yes Europe in our tax forms will be my job work. Pass I can't talk to him after during the language sorry. So round of applause.


n the lower left sort of over that blue uh Volkswagen you can see a sort of storefront canopy uh we added that storefront canopy there's glazing in that area and a big door into the common hallway actually a window into the pet spa where there's like some kind of mosaic tiles and stuff on the wall like a really cool wave looking mosaic that is planned on that wall so looking through that storefront you're going to be looking at this beautiful mosaic tile thing and the pet wash we added the roof over the top of it we've got the metal grates treating the brick openings and then we added the patio and cafe to that facade as well which includes the raised cement seating area that you're seeing including that retaining wall all of which has landscaping surrounding it trees surrounding it um you know treating this facade with with all sorts of of changes and you know updates and refinements so I think largely maybe we did hit the mark on this maybe the gaps in the plans are an oversight and we can update those and that would be sort of just just to add to that description too so that that cafe that we added that you guys just recently approved for the neighborhood commercial use is a two-story volume and so you have a cafe level on the first level that's open to the public and then above it kind of a mezzanine wrap around you have those free workspaces so it's you know you can sit in there and have a quiet time upstairs with your computer and do work from home or you can sit down and have you know more public you know a cup of coffee with friends or you know charcuterie or whatever you want to do but it really animates that corner and because it's a two-story volume it'll be a really cool kind of jewelry box to look into nice nice and we will provide the landscape plans for that gap so that that can be reviewed and if they need supplement we'll supplement them to ensure there's all kinds of plants in there okay I'm looking at the I just wanted to I'm sorry I just wanted to say that there the plants are called out the match line it's just the part of the street got cut off and I can just slide that over but yeah there's planting all along that that edge and lawn in front of it okay so I'm looking at the clock it's almost 10 o'clock I think this is probably a good place to start all stop although I will note that the next two comments the first one is we need civil engineering drawings and the next comment is we need a landscaping plan so unless we need to talk about either of those can you get those to us yep okay yeah I can do that thanks and then we'll pick up when we meet again um uh with this and your other proposals so um thank you for your patience um and I would entertain a motion to continue the hearing Dawn do you want to give any public the opportunity to comment well do we do that before we um close the here or before we finished reviewing all the comments um sometimes yeah okay because you know they've sat here okay thank you um so are there any members of the public who want to comment at this point uh are there are there any online not seeing any alilah okay all right okay thank you for your patience and um I would entertain continuing to April 5th just to continue that conversation um you are already full on April 5th I'm sorry okay but we can do April 19th okay so I'll make them I think I can incorporate some new stuff but um I also want to be just aware of I guess I guess I'm still living the feedback I got from the board a couple years ago which is finish what we have open before we start new stuff is that still the way the board wants to approach development review in general what do you mean by that well when I so I have stuff on my desk for months um like I have I have your next three meetings sitting on my desk ready to go so I can either on April 19th um schedule some of that new stuff or I can make room for this to be continued and generally I've been could I just I've been generally living the feedback that I got from the board a few years ago which is like let's finish one thing before we start a new thing um but you know it also feels kind of crappy to tell people who have a new project we're not going to hear you for two months I don't know it's it's a tough call Evan started to say something Evan yeah I was you know don't make your uh your schedule around my plans but I am out of town for the the 19th and if at all possible I would greatly appreciate having the opportunity to be present for that even if it's remote I'm not going to have the ability to be in front of a computer so so Marla what does May 5th look like our fourth or whatever that one that we did previously yeah May 4th is good um because then I can and that gives us an opportunity to address some of the things sitting on your desk yeah it will and it also give us an opportunity to work with Andrew and Evan um to maybe clear some stuff up rather than just finishing um I know it's after 10 o'clock and I'm sorry but I'm going to ask this question anyway sometimes Andrew and Evan have like a burning question that they really really want to get to before we close for the night do you want to give them that opportunity sure go for it guys you're muted I think yeah I think probably the uh it would be the next agenda item so I don't know if we're planning on there is one more agenda item it's still us I uh but uh just and that's probably a pretty quick question but you might have to warn the next hearing before I can ask it or whatever you know swear open it or whatnot okay so no burning questions on this one then okay so May 4th then all right we appreciate you throwing up the opportunity though Marla I'll make a motion that we continue uh preliminary plaid application SD 2205 to 25 Kennedy Drive to May 4th I'll second that up any discussion all in favor of continuing this hearing to what May 4th did you say May 4th yeah May 4th say aye hi hi and it's falling asleep um any any nays okay the motion is carried so we will see you back here on May 4th okay so do you want to thank you thank you okay so if we're we do you either need to continue the site the related site plan application we can't we have to continue it to a date certain um and you have to decide whether you're going to entertain Andrew Andrew's burning question go ahead Andrew or you need to open it first open it we have to open what the next agenda item number seven okay all right how do we do that it's very late I'm so sorry how how do we open it Marla well so you read the description then you ask who's here and then you swear them in all right um the next item agenda site plan application sp 22 008 and conditional use application cu 2201 of a brine farm road LLC to construct a 52 space commercial parking lot on an existing 4.3 acre undeveloped lot for the use of tenants on the adjoining multifamily residential lots at 255 Kennedy Drive let's make it brief go ahead Andrew I do you want to square them in I do I'm sorry I'm sorry the whole truth and nothing but the truth under penalty of perjury I do all right okay so this question was uh just about the next step for this and what the easiest solution is to the sort of problem we uh if you wanted to scroll down to like a site plan of the use of the project I think you guys all are aware that part of our parking is on an adjacent lot there were a number of reasons for that we talked about it extensively a preliminary plat in order to permit it we need a conditional use approval I think there was an oversight on on our part and the issue that never came up at preliminary plat which is that if you are looking at this picture right below where it says lot 13 area 2.1 acres if you sort of drew a line from that corner of the lot line where the hand is if you draw that line straight down the page to the sidewalk basically down the middle of the travel lane of the parking lot the little triangle that you're getting right there to the left of the purple and to the right of the solid black is in the r12 district um which doesn't allow for commercial parking so that like 40 square feet or whatever it is is you know the parking wouldn't be technically allowed I guess I'm just wondering if the easiest solution is to move the lot 13 lot line uh or Marla had said that having a master plan amendment to expand the master plan I don't think we have a reference I just want to know which one to do so we'll just get it started oh thanks for clarifying that Andrew I think this is really illustrates um you know why the plans should show the zoning district boundaries because when we looked at it in the office we thought the line encompassed much more of the parking area we thought it was um like that much uh so you know that's that's a big difference if you want I think that line that I had drawn is after the 50 foot adjust the board is allowed to grant okay so well that leaves that little wedge that's a big solution that's a big difference because then you only have what like portions of three parking spaces in that wouldn't be allowed so maybe the solution is just I hate I know you're gonna hate this but I'm gonna say maybe just give her to those three parking spaces until such time as you have a building on lot 17 and we could add them to lot 17 on the other side I presume somewhere right like off that I mean that's really the fastest way to skin this onion and well the travel lane is okay then in your perspective I guess the board would have to make a determination on that and um maybe that's something we can discuss at the next meeting is you know the commercial parking is a prohibited use in the r12 zoning district but would a travel lane to serve commercial parking be a prohibited use okay so we can look at that at our the next time we review this um I think and are we I think continuing this to the same may may 4th day yeah that makes sense okay okay then I'll make a motion we continue site plan application sp2208 and conditional use application cu2201 of a brian farm road to may 4th thanks mark and I'll second that uh any discussion okay all in favor of the motion say aye aye aye aye opposed no the motion is carry we will see you on may 4th thanks so much thanks for your patience thank you thank you everyone have a good night all right board can we uh marley can we do the minutes next time yeah I'm getting so nervous about the january ones but yeah it's just that it's late I know and I and I never save you room for minutes and that is my fault well you got a lot of pressure on my understanding I even had comments on them oh all right save them yes so we don't need to vote to close do we no you do not okay thanks for your patience everyone we'll see you in two oh three weeks yeah yeah take care happy spring good night good night all right recording stopped


Yes, okay. So good morning. Thank you for joining. I am Sanket and I worked as an SRE at LinkedIn And today we're gonna hunt a memory leak. So we all know what a memory leak is Okay, so just to reiterate memory leak is kind of a bug that you see in programs What will happen in that case your program with time? Starts using more and more memory and at the end it will crash because you have finite memory So we'll be hunting Such one today. So we actually faced one of the memory leaks in scenario So we'll be seeing a simulated one similar to that and we'll try to hunt it down today. So let's get started So here's what we're going to talk about today. So we'll be exploring Python and objects. So what do we mean when we say an object in Python? We'll see what happens when you allocate them as in when you create an object what happens exactly internally We'll see what happens when you deallocate them as in when it goes out of scope or if you delete it Then we'll take look at the leak We'll use the knowledge of objects and the allocation patterns and we'll confirm the leaks existence Because before you before even you go hunting, you'll have to know whether there's a leak for sure or not So we'll do that and finally will go hunting Cool. What we won't be exploring today would be any specifics of memory management and garbage collection in Python But we'll be looking at details that are enough to understand and the debug the memory leak scenario And also we won't explore why did this happen because we know the answer now Okay, so before we get started Let's take a look at an interesting scenario with Python 2 and integers. I know like Python 2 is Supposed to be EOL next earlier, but still the scenario is interesting. So let's take a look So simple code we import bunch of modules Then we create a list a huge list made up of 100 million integers. So it's as simple as that and we print the memory usage So it comes out to be 3.2 GB. So it's understandable like it's a huge list hundred million integers and The size comes out to be 3.2 GB Now what we do is we explicitly delete the list. So if you delete it ideally It's a god of memory because you have explicitly deleted but When we delete it despite deleting explicitly if you print the memory usage it came out to be 2.5 GB So there's nothing else in the program. So as you can see we just created a huge list hundred million integers And deleted it still there is 2.5 GB of memory In use. So what exactly is happening here? What's going wrong or what's going right? Or why is it happening? So we'll see after we learn how the alox and the alox work So objects you might have heard that everything in Python is an object So what what do you mean when when you say everything is an object an integer is also an object a string is an object I think there is an object everything is an object. So what what does it mean? Well, if we talk about Python's most famous implementation in C language that is C Python Here's is an equivalent. So basically an object in C language equivalent would be a struct called pi object And it has something called pi object head So what will head contain so head contains basically pointers to various functions among all the other things What kind of functions say when you call dot up and on a list? So what C equivalent functions would be called internally pointed to that function? In case of dictionary what what internal functions should be called when you when you say dot set on a dictionary or dot get on dictionary So pointed to all those functions will be there in the head part One of the interesting field of our interest today is a ref count that you can see So that is one of the field that is there in the head part. So we'll be seeing what is a ref count field and why is it important? So that is a pi object. So if we talk a specific object, let's take an example of integer object So integer object again would be Castable in C language terminology to the pi object So it will obviously contain head and head will be containing pointers to all those C functions And of course because it's an integer object There is a C-lang long variable or long equivalent type Contain in it. So this is an object or the objects when it comes to Python It's basically a C language structure So before we go into a locks or DL ox part Let's take a detour and explore two more concepts first being free lists So when you read the C Python's code, you might come across such variables called free list For various type of objects. So two example that I've taken here is a pile list object and a dict object So it's a list of pointers and it's confusing pointer to list and list of pointers So this is a list of pointers To save pile list object and the size is fixed. So let's say a size is 100 So whenever your Python interpreter starts this list is initialized of size say 100. So what the list is useful? So as and when your program runs you might be creating lists We are taking example of list So first hundred lists that are created will be pointed by the pointers in the list. So This will be basically kind of a cache. So when you Deallocate or those leaves object goes out of scope. You don't delete the memory. So what we are doing here is it's kind of an Object cache. So first hundred objects you allocate you keep it here and you never release the memory back So this is a free list basically a cache to fast to make the allocation of presence fast Because you always have at least hundred objects allocated in memory Even for for pi frame objects, what is a frame object? Whenever you create make a function call So even for that there is an equivalent pi object made So even though those frame objects are kind of cached So this is free list. What is free list? Basically cash of objects When you allocate you fill the cash and they can be kind of reused. So that is free list The other concept before we go to allox and deallox is garbage collection So in Python we don't do any explicit memory allocation deallocation operation like we do in C language like a lock calls or free calls So whenever object goes out of scope, they are kind of deleted or garbage corrected automatically So the python does it for us. We don't explicitly do it. But how does python do it internally? Well like most of the languages python also has a generation-based garbage collection That is that will link list maintain per python interpreter per python process for each generation's objects So it's it's a doubly linked list for each generation and there are total three generation And when you run garbage collection in the last generation You will clear the free lists. That is your cache of objects that you created initially So this is garbage collection and if you kind of read the code as it is from the source code of GC module This is what it looks like. So when you run the GC in last generation, you will be clearing all the free lists Why why is this free list and these concepts are important? I will see. So finally What happens when you allocate an object? So because we had free list, you know, we have a cache kind of object as so you have already allocated memory over there So if there's a space in free list, you will basically use the last free slot from free list and allocate the object over there Otherwise if free list is full all the slots are in use. You'll be allocating memory You initialize the object and You register object with the GC as in add to the relevant doubly linked list Now you see there's a little star over there. That means conditions apply What does it mean if you are to categorize python objects in say two broad categories or two categories of our interest It would be immutable and the container. So what does an immutable mean immutable meaning longs or ints or float kind of variables or strings so Values of these objects are kind of steady. It cannot be changed and contrast to that. There are container variables So what what doesn't container mean? They can contain other objects So a dick can contain other list or list list can contain date or they can contain itself. So these are two kind of variables Why does not every object get GC tracked? Well, in case of immutables remember, we had a reference count field in the object head So each app object in python will be having reference count. So whenever they go out of scope reference count is decremented And if your reference count drops to zero you garbage collected basically free the memory Why do we need the GC specifically for the container kind of objects because what can happen is you create a list and You append the list itself to the list now you have a reference loop So if there is a reference loop reference count will never drop to zero because list is referring to itself So this is a reference loop and reference count alone cannot help you with that So that's why you have a GC module. This module has capability to detect such reference loops and free the objects for you So that is GC module and that is why not all the kind of objects will get GC tracked But objects which can potentially have reference loop will only get GC tracked Now the deal location When do you deallocate the object when the reference count drops to zero as in no one is referring to it?  So all the integers that are contained within it are no longer getting referenced So you will have to decrement reference count for those as well So in an initial case for all the hundred million integers reference count will be decremented and it did drop to zero because there Were no other references to those integers. So memory ideally should have gotten free, but it did not so we'll see why If free list has space You put the object over there because it's a cache that we are trying to fill up And if your cache is already full say hundred free objects are already there You free the memory and give it back to us Of course, there is a bit more complexity goes inside it, but we are trying to simplify it So just to recap we had a free list free list is what Basically a cache of objects if there's free space you use a space from there There was generational GC especially for the container kind of objects which can have a reference loop When you allocate an object reference count is incremented or set to one If there's space in free list, you'll put it in free list And if it is a container kind of object you track it with GC when the allocation reference count has dropped to zero You untrack it from GC if it was tracked and you use put it in free list or the allocate Now the original case when we deleted the list still all the memory was not given back to us. Why was it happening? Well, as it happens with Python 2 and integers free list is not bound by a specified size So as in when you go allocating integers the free list will keep expanding So it basically unlimited in size unlimited as in there is no fixed bound So it's a linked list and it will keep expanding Why is it implemented like that?  So 24 to be specific So when you allocate an integer extra 23 integer space is already allocated So next 23 allocations will go a lot faster. So this is just implementation specific details And when this Free list will be freed of course when you run gc in large generation If you want to read more Exist specifics or the code part. I am leaving a link down. So you may explore that So now let's go to the leak So the app that we saw in the production was a flash cap. We all know what a flash cap is. It's basically I guess we all know what a flash cap is So here's what it did. It was basically a proxying app. So it takes the sttp request It calls some downstream service get some matrix and give it back It was as simple as that In simulated scenario, what does it contain? It does not Fetch matrix from somewhere. It just generates bunch of random integers and give it back to you. So that's the api There is a helper function a wrapper or a decorator which will convert the response into json There is some performance profiling as in how long did it take to Give the response back and of course, there's a leak which is we are here for So there's an amplified leak so that its effect is visibly apparent So if we kind of look at the code of the app It's fairly simple. I'll read read through line by line We import the app. We import two functions helpers one will help generate the response There is a bunch of random integers one is a wrapper which will convert our response into json The api code is simple. You just call the hyper function. Whatever you get you return. So this is the app as simple as that Let's try to run it So when we start the app, so there's it's a simple script mem usage dot asset So it will just print the usage for the mem the app that is running So when we start we haven't sent anything the memory usage comes out around 24 mb Now we send bunch of requests for sending requests. We are using a tool called apachi benchmark ab So what it is used for is like sending ton of request in parallel and then print out statistics as in how long did it take Median time max time at each step of connection. How long time was it taken All the fancy things can do but what we are using it here for is just sending bunch of requests So you can see ab-n50 that means send 50 requests to the given endpoint And when we print the memory usage, it comes out to be 4085 megabytes So that is a lot for 50 mb requests because there is an intentional leak put in the code But by just looking at this number 4085 you cannot be sure that there is a leak There may be legitimate memory usage like this number itself is not qualified enough to To qualify the existence of the memory leak So what we'll do I will take the knowledge we took from the initial allocation and the allocation part So what did we see when you run a gc in generation 2 what happens all the reference loops are If there are any reference loops those objects are collected. So that means that memory is free All the free lists are cleared.  So this will run a lot slower But you can see after gc memory usage comes around 4070 mb So that means 15 mb of reduction, which is not a lot and still a significant memory is still occupied So this tells us that There's a leak. So I hope this is proof enough To qualify this code as to be containing a memory leak So let's go hunting There are various tools available First being code and panelysis You have a process running It is using 4gb of memory. You just take dump of the memory snapshot. You analyze it You can analyze what what can you get? Okay, you will see that there are ton of integers out of 4gb 3.7 gb Are made up of integers, but this does not tell you much. I mean this only tells you that There is an integer leaking somewhere in the code But where? It doesn't tell you So there are some native libraries in python Some of the names are listed object graph memory profiler, heap, trace malloc, etc We went with trace malloc. Why? Because it comes built in with python Python 3 4 I guess and of course this code was running in production So it was not really feasible to pull any library from the internet and run it from production It's not as simple as that. So we went with trace malloc What does trace malloc do? Well as the name suggests It can trace back the object where it was created It can also print statistics As in how much memory was allocated at which point in code as in which file and which line number And one of the other beautiful thing it can do is it can take snapshot during your program run time And you can compare snapshot of memories and see what changed and what caused the change So Kind of hello world or how to program for trace malloc You just import it. You don't have to install anything because it comes built in You do a trace malloc dot start so whenever you do start from that point onward trace malloc will be tracing all your memory allocation As in which part of code is allocating what memory Then you can take a snapshot using saying trace malloc dot take snapshot So snapshot will contain memory allocations done till that point And then you can print statistics. So here we are printing our top 10 allocations So this is how trace malloc you can use trace malloc How does it work? Well, uh in python 3 there is a memory Related operations api. The functions are something like pi object underscore malloc or pi mem underscore malloc free So any any time you do any memory operations it will go through these functions So what trace malloc does is whenever you do Start trace malloc and do a trace malloc dot start Trace malloc will be overriding these functions. So whenever these functions are called it will come to know Trace malloc will kind of take note of where the Memory operation is coming from as in which file which port number it will register the information itself and then do the memory allocation Similarly, when you free any memory trace malloc will first come to know because it has overridden the functions It will register like who did this operation which part of code did this operation And it will do the free operation as regular So to reiterate our app was stateless And what it was doing is fetching some matrix and it was serving back to the scdp requester So why why is this important? It's important to understand the nature of the application So as you can see during the runtime of the request there is not supposed to be any memory allocations done because it just fetched Kind of push so there is not supposed to be any persistent memory allocation inside the memory How will we use this information? Let's devise a plan We start the app we warm up maybe by sending couple of requests so that everything is Loaded into memory We send couple of requests and warm the app up We take a memory snapshot. So when you take a snapshot, you have all the allocations done till that point So you have that information with you You send some traffic as we did earlier And we'll take a snapshot again at step four. So in ideal case when you send traffic because app is supposed to be stateless It's it's not supposed to Store any memory or use any memory. So when we compare snapshots step two and step four In ideal case, there should not be a huge difference But if there is a memory leak a snapshot comparison between two and four should show a huge difference And it will tell you that where the memory allocation was done So in the end what we'll do is we analyze these two snapshots and we'll see uh, what what part of the code did the memory allocation So here is the uh code equivalent code for our plan So i'll again go through it. So we import trace malloc We do trace malloc dot start so that each memory operations will be kind of traced that point onwards We had our original api and we add one more sttp endpoint called slash snapshot Now what we do here is first time you call slash snapshot It will take a memory snapshot. That will be the initial snapshot at step two So when you first call it, it'll take a snapshot and when you call it, uh, one more time It will be comparing the original snapshot. So this will be the step four when you call it again So it will be comparing with original snapshot and printing top five stats So, uh, I'll pause here for a moment. Uh, take a moment to go through the code Should be fairly understandable Go we're good to go So let's execute the plan So first as we said we'll warm up the app a bit. So we'll again use ab uh hyphen n2. That means, uh So we'll be sending two requests. Uh, just to warm up We'll uh take a snapshot. So this will be the initial snapshot. We'll be calling uh slash snapshot api Again as usual, uh, we'll be sending 50 requests as we've been sending So in this case again, this will be running a lot slower and that's why we are not doing a live demo Why why a lot slower because when you do start doing trace malloc each in every memory location and there are tons and tons of it Each of them will go through trace mallocs over it and uh, the api calls So trace malloc will register all of them and do its own state management. So this will be running a lot lot slower But the uh bonus point is like you will will get to know what the leak is So again, uh, when we call uh this last snapshot api again It will compare the that snapshot with the original snapshot And it will print the statistics So as it comes out, uh, the first line itself in top five, uh, there's a file called helpers dot pi and line 25 Did uh approx four gbf allocations So it's supposed to be stateless, but this file this line did all the allocation So we we we know where to look So what was the actual culprit as it turns out the json api wrapper, uh was Doing some uh as we said, there's some uh time management or the profiling done So whenever the function was called it was uh like taking note of how much time was it taken and it was storing The time taken into a global variable. It was not exactly global in production environment, but in this case we put in global variable So as you can see the highlighted code, uh, the there's a global dict called perf data And you are putting the time taken into a global dictionary. So because it's put in a global dictionary It will never go out of reference because it's a global variable reference count will always be at least one So despite we ran gc each time the memory was not collected and hence this is a leak Uh, if you want to go through the code, I'll I'll wait a moment So in actual production, it was a thread pool library overridden and there was Bunch of two three more layer of abstraction So by reading the code, it's not really obvious because when you work in complex code scenarios, there are The memory leak can be hidden in a like two three level of down downwards the dependency So this kind of tracing only will uh bring this issue to light So yeah, this was our leak Just to recap We understood how python does memory management. That is freely is garbage collection when does what gets cleaned We understood application behavior. This is important because we know the app is stateless We were able to devise a plan and kind of use it to compare snapshots and uh get the memory leak So that is it I hope you learned something new today. Uh, thank you Questions forgot any Hey, thanks for the talk and that was a good one Uh, in this case you're instrumenting the process from scratch, right? What if the process is already running and it starts me misbehaving? Do you have something for that? Uh, you mean the dynamically attaching to the process was running first performing right Properly earlier and then it started misbehaving and doing a lot of mallocks Okay, what can you do then like in this case you started the process from scratch? Yeah, so in in that case I think uh, it will be a bit harder So I tried to first do that that let's not disturb the process If there is some solution available to attest with the process and then kind of do a sampling sampling kind of profiling But I could not find such tools. I mean if you if anyone is aware of any let me know But this required some code change But the bonus like or the brighter side was that I didn't have to install any external dependency But that tool would be great. I mean don't disturb the process and trace the alox from outside I'm not sure of any tool that does that at the moment Okay, thanks Hi Suppose in case I'm training my model. Okay. It's a kind of standalone python code, right? How we can trace memory leaks in that So memory leak You generally get to know when your process starts dying So in our case what was happening is we had lots of uizgi workers And when we started sending a lot of traffic, uh, they were configured to auto restart So we didn't notice it. But when we checked the log, we were seeing lots and lots of restarts So this generally comes in light when your process starts crashing as in it use all the memory available to it and then it crashes So that's when it comes to know. Otherwise, you would need to know that this is the Uh, kind of memory user that my app is supposed to be using and if it goes beyond that and it So the main main thing to detect one is it keeps increasing.  How do you debug a running process without disabling? Impacting a running Yeah Context so a stress is your go to option for that again won't pinpoint you as you can do So it won't pinpoint to the code. So it as good as but you'll still have a much more detailed context of what is happening in the In the process level than what you would have otherwise But at the same time, there's also another python based debugging tool called drgn, which might help you in doing this as well Yeah, drgn. I'll check that. But the original question the question was that Wouldn't it be easier to enable debugging flags in python and just run it with that instead of this? There are There are memory allocation hooks available in python which can be in production You will not have debug version of python. Oh, no, not in production Yeah To debug these kind of cases these kind of cases like production only will get that bunch of traffic So either you'll have to figure out how to simulate it on on your dev environment Or you'll have to do it in production. I mean the production traffic will be there in production traffic only So it may be tricky to kind of reproduce on your dev


Welcome to the Crimson Engine. My name is Rebedium. Today we are talking Instagram. A couple of months ago I was talking to a friend of mine who has, I want to say, 400,000 Instagram followers and shoots a lot. Like he posts every single day.    And I thought, wow, what an interesting challenge to do as many setups, as many different outfits and looks and lighting setups in a day as you can. So I got together with Madison Fitz, actress and model friend of mine and we just spent a couple hours trying out a lot of different looks in the hope of producing a bunch of content for Instagram. So we spent about four hours in the hills in Griffith Park and in the studio doing as many, you know, quality of different lighting setups as we could which for me was a really great exercise in shooting the same model in multiple ways for different sets of photos all in a single day. So we sat it out in Griffith Park and it was the middle of the super bloom. The whole of the wisdom tree hill was covered in these beautiful flowers. It also has these interesting looking power staunchens. They were able to use for different angles and different light. We were there at about 11 o'clock so it was kind of high sun and it had Ian, the guy who was helping me shoot that day, hold a reflective fill in the shadows. So we've got a couple of shots of her standing at the power structures. A couple of shots of her lying in the flowers. A couple of shots of her sitting around in different types of flowers all with pretty much the same outfit. I was shooting on my 5D Mark III which is still an absolute killer camera. I have shot a bit on the EOS R and I like it. The reason being that you can tell immediately what your exposure is because of the electronic viewfinder. This is showing your settings on the screen.  So I do like that. I also like that it's significantly smaller. So I may change over to the EOS R in the next couple of months. We'll see how it goes. Next we went back to the studio and I wanted to get some back light shots while the sun was still pretty high. This 6x6 fabric of quarter soft grid on the window let the sun come through and then had a Intellitec 2x1. Is it the Lightcloth 100 as my key? Then I changed that out for the LC-160 set which is two 4x4 lights that sit on a collapsible panel and give you this big 4x2 light source. What I love about this is it actually looks like a window in the eye of the model. So even though it's lit it gives a really naturalistic look. It gives you this window that you can move around, control the brightness, control the color temperature of because they are bi-color lights. Run off batteries if you need to. And it gives this beautiful soft wrapping light that's perfect for portraiture. Next we moved on to a Quasar top and bottom setup which is more of a kind of science fiction maybe even like mug shoddy kind of look, Guardians of the Galaxy I call it. With double back kickers. The last two setups I did were natural light, doorway light shoots. One in the doorway of my studio which gives this nice angled light. Doorway light is a really wonderful place to shoot. One because you don't need to light it. But two because of the big separation in zones. If you have someone stand in a doorway they'll be lit by the reflected light outside or the sun itself. And behind them the dark of the house or the studio or the interior will also be four or five stops darker. So it really highlights the subject. All in all we took about five or six hundred shots. Maybe 80 of them were good and I ended up editing maybe 40 of those. If I were to post these on my Instagram I could get over a month worth of content with one model. Now of course you don't really want your Instagram feed to be one model for an entire month. What people do is do this over a couple of months and then interspace the models. So you're posting new pictures of different people every single day with different lights. But it was real eye-opener for me how many if you actually set out to do lots of different photos lots of different setups lots of different outfits. You really can get a couple of good shots with each one of them very very quickly. It's almost like shooting a catalog I really enjoyed it. I really encourage people out there to do this as a creative challenge and just really see how many bits and pieces you can get because it's a great way to push yourself and explore new things. Thank you very much for watching. Thank you Madison and to Ian for helping out. I'll leave a link to their Instagrams in the description below. You can also find the lights that I used and the cameras and the lenses and I will see you next time.


Hi and welcome to the session. Let's work out the following question. The question says, find the area enclosed by the parabola y squared equal to x and the line y plus x equal to 2. Let's start with a solution to this question. We see that the given parabola is y squared equal to x and the line is y plus x equal to 2. First of all, we will find the points of intersection of the parabola and the line. So, we put y equal to 2 minus x. We call this equation 1 and this equation 2. So, we put y equal to 2 minus x in the first equation. This gives us 2 minus x, the whole square is equal to x. This implies 4 plus x squared minus 4x is equal to x. This implies 4 minus 4x minus x plus x squared is equal to 0. This implies x squared minus 5x plus 4 is equal to 0. This implies x squared minus 4x minus x plus 4 is equal to 0. This further implies that x into x minus 4 minus 1 into x minus 4 is equal to 0. So, this implies x minus 1 into x minus 4 is equal to 0. This means that either x is equal to 1 or x is equal to 4. Now, when x is equal to 1 then y plus 1 is equal to 2 implies that y is equal to 1. Now, when x is equal to 4 and y plus 4 is equal to 2 implies y is equal to minus 2. So, the two points of intersection of the parabola and the line are 1, 1 and 4 minus 2. So, let us draw the line and the graph sorry line and the parabola on the graph. These are the two points of intersections. Therefore, we can say that the required area is this shaded portion that is equal to integral where limit goes from minus 2 to 1 such that y plus x is equal to 2 that is the line minus integral where limit goes from minus 2 to 1 x where y square is equal to x. Now, this is dy this is also dy. This is equal to integral where limit goes from minus 2 to 1 this will be 2 minus y dy minus integral where limit goes from minus 2 to 1 y square dy this is equal to integral where limit goes from minus 2 to 1 2 minus y minus y square dy this is equal to 2y minus y square by 2 minus y cube by 3 where limit goes from minus 2 to 1 this is equal to 2 minus 1 by 2 minus 1 by 3 minus 2 into minus 2 minus minus 2 the whole square divided by 2 minus minus 2 the whole cube divided by 3 this is equal to 2 minus 1 by 2 minus 1 by 3 minus minus 4 minus 2 plus 8 by 3 this is equal to 2 minus 1 by 2 minus 1 by 3 minus minus 6 plus 8 by 3 this is equal to 2 minus 1 by 2 minus 1 by 3 plus 6 minus 8 by 3 this is equal to 8 minus 1 by 2 minus 1 by 3 minus 8 by 3 and that is equal to 9 by 2 square units this is our answer to this question I hope that you understood the solution and enjoyed the session have a good day