Caching: Go big or go home

Video thumbnail (Frame 0) Video thumbnail (Frame 8765) Video thumbnail (Frame 23026) Video thumbnail (Frame 37287) Video thumbnail (Frame 51224) Video thumbnail (Frame 65160)
Video in TIB AV-Portal: Caching: Go big or go home

Formal Metadata

Title
Caching: Go big or go home
Alternative Title
Go big or go home, scaling through caching
Title of Series
Author
License
CC Attribution - NonCommercial - ShareAlike 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this license.
Identifiers
Publisher
Release Date
2016
Language
English

Content Metadata

Subject Area
Abstract
Could you survive Black Friday traffic loads, or will your app fall over if it goes viral. Do you know what your etags are doing right now? All of these are important questions and this sessions aims to answer at least some of them. We will go through how to get caching working for you and show you some real world examples. It will start small at conditional HTTP requests and build up to application caching using a layered distributed cache service driven by pub/sub. "There are only two hard things in Computer Science: cache invalidation and naming things. " - a famous saying. Let's make sure we're only left with one hard thing, naming the next .NET.
Web page Server (computing) Digital electronics Service (economics) State of matter Set (mathematics) Water vapor Client (computing) Web browser Streaming media Mereology Field (computer science) Product (business) Number Medical imaging Heegaard splitting Crash (computing) Cache (computing) Semiconductor memory Operator (mathematics) Queue (abstract data type) Videoconferencing Electronic visual display Endliche Modelltheorie Hill differential equation Analytic continuation Proxy server Scaling (geometry) Regulator gene Information Plastikkarte Database Instance (computer science) Cartesian coordinate system Function (mathematics) Telecommunication Website Point cloud Pattern language Quicksort Musical ensemble
Application service provider Group action Range (statistics) Client (computing) Different (Kate Ryan album) Core dump Local ring Physical system Link (knot theory) Arm Namespace Structural load Bit Instance (computer science) Message passing Data management Process (computing) Hash function Oval Order (biology) Pattern language Cycle (graph theory) Quicksort Reading (process) Web page Sequel Dependent and independent variables Maxima and minima Event horizon Latent heat Cache (computing) Term (mathematics) Googol Configuration space Metropolitan area network Default (computer science) Matching (graph theory) Key (cryptography) Demo (music) Server (computing) Weight Interface (computing) Content (media) Multilateration Limit (category theory) System call Magnetic-core memory Word Personal digital assistant Data center Musical ensemble Building Run time (program lifecycle phase) State of matter Multiplication sign Mereology Semantics (computer science) Mathematics Semiconductor memory Heuristic Cuboid Software framework Extension (kinesiology) Point cloud Area Email Data storage device Benchmark Type theory Googol Repository (publishing) Interface (computing) Website Remote procedure call Physical system Data structure Implementation Server (computing) Service (economics) Link (knot theory) Web browser 2 (number) Program slicing Flowchart Speicherbereinigung Absolute value Default (computer science) Execution unit Dependent and independent variables Multiplication SQL Server Synchronization Point cloud Object (grammar) Communications protocol Local ring Extension (kinesiology)
Wechselseitige Information Greatest element Database Insertion loss Icosahedron Casting (performing arts) Different (Kate Ryan album) Semiconductor memory Physical system Binary code Data storage device Streaming media Bit Instance (computer science) Connected space Band matrix Type theory Message passing Process (computing) Oval Repository (publishing) Interface (computing) Remote procedure call Physical system Resultant Reading (process) Server (computing) Implementation Real number Virtual machine Rule of inference Product (business) Cache (computing) Term (mathematics) Form (programming) Default (computer science) Data type Execution unit Serial port Multiplication Key (cryptography) Twin prime Interface (computing) Chemical equation Planning Color management Line (geometry) System call Uniform boundedness principle Database normalization Event horizon Software Personal digital assistant String (computer science) Synchronization Local ring Library (computing)
Building Scripting language Multiplication sign Archaeological field survey Set (mathematics) Rollback (data management) Mereology Computer programming Response time (technology) Mathematics Type theory Semiconductor memory Military operation Hash function Information Local ring Physical system Scripting language Data storage device Electronic mailing list Database transaction Instance (computer science) Term (mathematics) Sequence Element (mathematics) Message passing Process (computing) Hash function Oval Normal (geometry) Right angle Quicksort Reading (process) Point (geometry) Reading (process) Trail Server (computing) Service (economics) Virtual machine Maxima and minima Electronic mailing list Drop (liquid) Streaming media Number Element (mathematics) 2 (number) Goodness of fit Cache (computing) Operator (mathematics) Key (cryptography) Server (computing) Uniqueness quantification Computer program Database Coprocessor Uniform boundedness principle Word Personal digital assistant Blog Universe (mathematics) Synchronization Key (cryptography) Object (grammar) Exception handling Local ring
the guildhall coming in.
just don't think it's the. it's also in so many wanted to push will also important in the one is vital should rethink. i work at the small company called autumn and currently in parental leave but on a note to have been in the uk on the t.v. and radio player or team for almost two years. all about this cashing is from our experiences and and household things their home so that's a was staying in black friday that is not something you it has become the manifestation of how were not able to scale and it happens every year. hill no in rockford is coming and sure enough some sites crash alone and here we have been left side we have best buy have failed miserably and able to sort of customers are on the right side you have. wal-mart now and then quite cocky for some time. they year of have to switch to know buy from them not had any problems they did a deployed to production during black friday own that's so confident they are a we have the same situation in a way to. and we are a lot smaller country and but if you tried to go on the midnight or friday to any off the electronics store online shop it failed to complete was serving two hundred ok stay did read a page within a minute. that's better than rest tourists did not deserve anything. quite funny to see that now all these shops those but millions and advertising just not to sow stuff. i'm as a success. so what's so we need to fix that me to talk about his wife his doesn't work. and then we see this is private sector but things are working on the have government we have the in the region edition of the i.r.s. that's got to talking. i guess everybody runs to check their taxes when you get the pre field for him to see how much you get back home as to how to pay that fails as well known but i can understand that a lot better they are under heavy regulation state cannot scale the same way in cloud day. the sort of fair i can see why they can do it. but they're getting better at it. and that r.k. our black friday is the elections are all we get a lot of traffic on the new site to try new site displays video they need metal data that comes from my team and we saw this was not going really good. and one of the operations people and in double the number of service and asher everything was running fine again. home and during my rant on this are a. is said to a friend well you can buy a hundred servers and passion for twenty four hours or a three instances that setting of memory for course that will set you back eight hundred sixty dollars. so he said while you can do that he will take down a database that i don't want to hit by database i see no reason why we should hit the database when you hit a the first page. the and that's were catching coming. there's a lot more to delivering an experience and the extreme loving cashing it's just a small part of the have everything from. the main modeling you have infrastructure we have you can you use queues you have our patterns such a circuit breaker especially useful when you depend on other services which they also get low during black friday so perhaps your credit card so was can't respond. etc and then you need to sort of can we take that company doubt can wrap it in something of a circuit breaker and continue. and so things will help a lot of my whole i know the complex guys will speak to moral i hope they will talk about this for him but catching his is someone part of making this whole thing work. and now want to talk about has three parts or two parts of catching up. if you see from web client we have a to b. cash that lives with the client can be a proxy on the waiters are but normally it's very well implemented in the browser. then how to cashing them cashed in i as solo across the water service said cetera and then at the older and you have the application cash. and you'll need to heat your application because you have a use for his log me in you may need to display information for its users so we can on this isn't always used out of cash in and just get rid of the problem now some today i'm going to talk about eighty to be cash and the application cash from a cd and i sort of. that cd and so on of don't mention that but of course you have your static far as you have your the our streams. and images will be so from the cd and. or. so it's to be catching is to find in our of see seven to thirty four in spite of the age to be this split today's plate up from its pieces occasion to separate documents down and the purpose of age to be cashing is to significantly in.
improve the speed the and experience for users to this is dawn. now two things that happens one is that the latency goes down request a solo career and. traffic goes to so that's really good thing what they should be catching don't hit our servers but it's not a soul is it works but all. but. and it's all about storing responses when you talk this over and hopefully reuse that responses of calling service. the and says that the store response come visit of fresh if the response can reuse to get out of the nation and this is somewhat like milk you know that the call that will expire some time and really don't want to use that most until you've checked that is ok. and if it's fresh that is the the. if a response is considered fresh decline will just use it it will talk is over if it has to validate that response it will call the surrounding we will hopefully get what is called a feel for response without any content. and. one thing to keep in mind when we talk about this specific a shown a stance on it is not written as to how you should cash it is written in terms of what you should not cash what should not the cash in the client and is also what should. would not be reviews to do something so i read than you can read this one. them. all. the. i. it's so as as a the. it is what not to cash and what not to reuse. and the first part of his the timing is this response fresh and that's all very well implemented in the browsers now extreme good understanding of this or any will have a completely different situation if you're making a.b.i. and the a.p.i. clients that are not processes that are associated the client in the net. that wall of them. not how cashing in building. so if you're trying to use some of these techniques with an a.p.i. you absolutely need to get your clients so to really use it to need to educate their clients. so these are the first three i had theirs. they're sent in the response from the servers and tells the client the whole long this response will be valid. and the last won here he sticks his. when the don't know when you don't have the order headers if so does not give you a mock sage or a shared my stage expires and the user agent will try to calculate if the response is still fresh. that is drawn by looking at the last modified you have of them in a local cash in the browser. it will look at when you last request that this and look at now. and if you're a christening it now. the time between now and your last request is ten percent or less. over the document was last modified it will still be considered fresh they will not necessarily called is over. the this is only the suggested implementation there's no specifics in the sophistication of says this is how few restrictions works but there's a suggestion on it. and so if it's not for if it's not fresh. we can then ask this or is this response to locate it. and to do that we utilize to headers as the tags as anybody use the tax. if you know. and there is a last modified and these are combined with to request others if not match and if modified since so what happens is that you serve all or can add to any type of this signals a hash of the content in response. and this so. when the clients want to reuse response when you type it will send the tank to serve an iphone match. so the service he has this changed if the service still has the same he tagged it will just give israel for to the client to climb will get a really small response and. the can be multiple the tax so that they come in multiple valid responses in the cash. so so may have won and clinton have several and if one of the much it will get a feel for the eat tides are also a comes into flavors there's something called a week and a strong the week he told me instead. it's not bite correct so we cannot use that for range chorus but it's semantic lee the same as you have a strong it means that is by correct who can actually do range careerists on it and just get a part of the document. so that's one way to do elevation and then you have on the last modified which is a date now a sticky date is without milliseconds that means that if you have a frequently changing system you will not be able to get to use the last one was for this because you. you won't know if if you have the same or not i'm and use last modified to get it if modified since i requested are a sick if so what has changed since then. the nation can also be used for post and puts him about that is used to validate if the sas change when you posted something and not for cash. a. but there is a few more links on this show if you want to read and and begin to mark nottingham as written quite a few of the specs feels was a tutorial on on cash in on the edge of the cash and how much of work a militant miller has created flow charts from if you. they want to the into to how the prosecution which is really nice resource and and then there's a on a link on here he sticks. i'm going to does slightly only tags on later on. so now that we know sorted out the decline in cash and small to the server. with the a's been at the core or whatever it's called now. currently the name space for this is microsoft extensions cashing in they are now. delivering two types of cash. you don't know core framework you haven't in memory cash the which is powered by the action or he supports called back on the weeks now and then keys expires from a cash. and you can put priorities in cash items. and it will compact the cash by ten percent on the governor's collection so if if the whenever garbage collection of going to happens ten percent of the keys in cash will be thrown out or and and as they think that any coverage mission again to that means that the u.. you so much memories of those that probably need something to be freed. them. and remember that if you are on that for five are there's a limit on two gigabytes of memory notices course i guess as its change when he gets to that. they also were distributed cash a useful when you start having multiple so risen and you to a central cash. it has comes with three implementations.
the core memory cash based on one which is based on read this one was based on sequel so are now with read his own. asher abs and and google cloud as your most people will use the the redness imitation of it and it's also worth not that you will be responsible for sarah leising are objects in the cash if you want to use this one. so arm local cash. a simple as a dictionary. thing their data lives in memory. so as fast as a lot faster than going to another process because in the process is your says available. word of caution with local cash. these objects they are immutable so if you retrieve something from the cash and change it. and then you're treated from a cash and another request. it's changed. oh so you have fun but without one of them the forefront of i think there are going on he spent three days the it. from. so let's see how that can log. so what we have here is. an interface of falling apart and cold cash the side. the cash inside is one of the patterns recommended by the marks of partisan practices team for those who view who were on the year of the batter's box is this event. in all slow you should know this so i just spit into phase into so we can concentrate on one part of it. we have the. gets called to the cash mistakes the cash keep them dating thing takes a funk. and this is very call repository to data from a slow source of and then you have time to which you can tell the cash i wanted this to live in the cash for that long. on if we look at the implementation of this. from the sea. own is fairly simple because i am here is so good to its old running on know the old don't not so i use the system run time cashing memory cash. and when they shun it calls on a try to get the key to find stardom it returns that if not it will execute. the funk we passed and i had dived into the cash and return it. it's quite simple and. and here i have a small service of. and there's a service out there called from random used to talk me so if you need some cheese and a dozen its is nice place to get to state or so as you might call this takes are almost a second on the moon and his wife i know. and then we can try it with a local memory cash. acedia ok i'm sorry to music is so and broking quite fine we can. on let's just take tough on. we can let it run for some time. own and see what we get. it's all very interesting phenomenon will be fast but it will mean more interesting than get to the most cash is so four thousand six hundred requests per second. no really fast. the user's loved on with it. so what happens when. we move away from a local cash to remote cash so let's say you start load balancing his servers. let's say you run in multiple data centers and soda is it ok that you have local cash needs are or what happens if we used to its are one and then after all it's over to the cash is different because they've been initially as a different time a user will get different responses is that ok. probably not and that's why one which was central cash so success has read this. so we did that our case. actually had the cash or manage cash. when you start to want to its. it was so i think most of sort of temple making a cash in our own what was nice about it was that he came with a client for microsoft which had a local cash as well so when you're called remote cash he got something to you and automatically get it in a local cash so we had the fastest wants times. and now when we moved to read this because the man is cash will be discontinued december so everybody has to move microsoft has no longer made a client for four for the cash they use the library of from the great process stock exchange. too cold to talk to read this but that does not come with a local cash and the helpful understand page says that you should develop something yourself if you need that well so i did it. i'm so what happened was that was saul the. our c.p.u. and haywire. we got really terrible response times and they tried to dig into it but we saw that i spent almost fifty five to the fifty six percent of the c.p.u. time on the sterilization. and that's because. so we follow the guns for microsoft and use the body from. he also realizes are not equal and. and young queen is also a speaker hair than busy he has done some benchmarking alone sellers and there's not only for buyers analyzes those difference there's a lot of difference when it comes to jason sterilise us all. his website is a burning monk if you google burning monk and benchmark you all get to this page or a and bomb there is from microsoft and it will not be that fast unless you tweet it comes for quite a bit of confrontation which needs but dawn to to get it off. after that speed it has to do object slices deaths etc but the by default. so proud above is a protocol from google. the don't that implementation is again from the great guy said cycle for it. is really fast message back isn't as well. they are they working a little bit different way message pack is perhaps easier to start with. that's one will see here so. on one star run this demo are on the on a local read this instance so read this is a cash server region in the next single furthered so. some want to think about it when you can figure it. that you may want more of them. exported monarchs of resources you can install using new get a loan and wants what i like about it. the we can. easily the uk it here the. which. the home. it's a new one. i. so it comes with a client face so i can to connect to the cash i can see the stats on it. arm. they can go. but we can see the keys in there. and we can i don't believe he's so wanted to go of course connect to your ashley caches as well if you run radisson osher it. so if we the trying to call. call this service the postman.
so if you use the binary for matter of when we do this. i want to. iverson here if i call it will return two thousand. the people and if you try to. just know that our system without remember that we don't have any network late and say so all what we're seeing now is. in its about its out of process but it's still on on on one machine. so. it's not running. one. so pretty bad when. and then we can. hopefully get some better result if we use message back. a. so yes we could handle of the more requests home. when difference or less. the. its own rules. called for that is quite simple. when we work and read this since its single treaded you want to have only one connection to the server. the climb library of real multiplex and pipeline alone all the commands for you. but that doesn't make sense to have more connections so will want process so out of the many ways. when we look at the the ad for for others it's quite simple. the only difference is that he said need to sever lies the data. so this an interface call item sterilise are the same when we we get date that we need to the center lice the data yet. the. if me. you know the binder for much as it was a nothing magical going in there just taking a bond form of thing. so i sing it using members freeman not but its own. and same with message back to use them as expected loss or this one cash just the types of those for your own makes this civilisation past them. all the news members to muscle. so how does not look in production. along quite good receive have a lot of cash it's like not go so if you cash ms it's now what's worth noting here is the network bandwidth. when you. user read this in assure you only see a pricing you pay for size to pay for redundancy pay for if you want to have local storage or just live in memory. but you also pay for network bandwidth and then don't read early clear on how much better balance you get to assess gets low enough for granted medium and high and certainly is things like crashing into a problem because you've hit a and that abounded issue or maybe. that was our problem so. to solve that we wanted to implement what we had to manage cash that we have a local cash and the central cash. so of course a bit like this. the case because local cash if it's not there it will fall back to the remote cash it's not their call this the execute the method from the application and cold his loathing ak here repository. and all the opposite wall and the date that received to your cash us. and our implementation of that. his call a double cash again we implement the same i cast aside interface. this is the impact in terms of call this a decorator it takes. the local cash and remote cash implementation. when you add something that simply just added to the low cash from which would be the memory cash was older and. it's all been also i'm too remote cash which will be read as cash. when we get things. wall first try to get it from the local cash if not they will fall back to the most cash and. those two will be responsible for adding the item to themself. so we still have our own one problem with this and that is that he catches will be out of sync with his. the data will have and the other local cash will depend on when you got it from remote cash to solve that we can use a feature in read this. called pubs up as a really simple way of this reading messages read this is this is used in a single are for instance you use read this as a backup plan when you have multiple same lines as today's read is to communicate between the single are instances the same of. for some guy all for though so if you don't use that in that mode. what happens is that when we started a tenner this to be a push a notification. the and three and that is published by read this to all those subscribers and then we have the local cash on each instance to update day data based on the this over. home now is get a bit more tricky. we have a. i cashed publisher. now a simple interface just tells to notify of i will say today key and the data time. need to pass the type of data since the cash will be responsible for the sarah leising it into memory and it will not know the type. it also notified the lead so something is deleted from the cash only can do that. i don't have the cash subscriber. and. and it was all taken around town or four when the cash is updated or deleted and also as a method to get data from the cash own which is used. and then you have the implementation of this. a publishing cash. the. which takes. the cast aside interface those also implements because i've been for so but it takes the more cash will be ready cash and takes the cash publisher of and something is added we've got to the cash when then notified that these key has been updated own told subscriber. years. and if you look at the get. of them. it's just a normal all of our. normal gets. every invoke. if you invoke the method a repository were also notified that we have updated local cash. the bottom here we have the. the. it's the us public in cash at sea. get there the subscribing cash is well wrapped the i cast aside and face again. it will drop to local cash and. it will cast read his rise types. and it will attach just on the subscriber these two methods.
and when we get the message that cash is updated. it will get the data from the remote cash. take if there's a time to live when art and added to the local cash. and this means that all our local cash instances will be in sync. them and also means that we can from other processes forcefully in malaga eight and update our cash. so if you have a messaging infrastructure and the so you know and you get a message that something has changed you can proactively invalidated cash. we had one problem i don't i came the there are so many layers of cash. that he could use an hour for something to time out because we didn't have any invalidation and that's a problem when you revealed have been rough some reality show by mistake or. then somebody is panic and so is really nice to be able to invalidate forcefully after the cash and something changes. and. and so let's just see how that can work. so the here's our pubs some cash. so not is that again we have a really fast response times as vindu hit a local cash we don't hit the remote one we have our foreign mr here alone i love pronounced at it and then week the i have another small program. from. the. i'm not to hear. and it's called the same service of them called our cash or updated its some to publish message so if i now hear it. this object around. and this is really really old. and what happens when we started to use this idea is that we see that isn't from a one of the so risky see a performance counters. you see that we do have a lot of local cash its own i really do have some cases where the data is not in the local cash. and then we had to read this over and all of these will go to the database or some back in service. and this is really want same justice. it's part and. now we can of course go wrong you have. i'm not saying i usually put all their cash in the local local cash. but you have more memory in a machine then you think and we took all the t.v. shows. the nikkei and then we saw last them and store them in a in readiness that was about seven hundred megabytes not to not the streams but only the metal data if you took all only the forty six thousand active two shows what were we have the spare rights which you can actually watch our war. down to three hundred megabytes of data so we can in fact keep a lot of our data in memory at all times. that's a good thing. i. and the really good thing that happened is that never abandoned dropped. before we had this little cash wrapping doing what cash we were off to war two point. how two point seven given wants per second of traffic on read this instance as a. you won't get that normally think they were nice tosses whom are running read this before it had gone in general are the building and. after he added local cash the dropped. to six six seven hundred megawatts. of freedom arts. and so. the in one go around for alice these are numbers though. so time is it. any questions on this. ok let's continue i was on goodness in hand. read this is a is more than just a a key values or if you use it only for key value store i think you know perhaps is not utilizing is completely the i recommend all to search for a doping called an introduction to date at times and obstructions. and really nice three that one and try to mentally map that to how you can use those data holes in your application of. the you have key values storage is the norm on his use of cash but you have lists. you have assets are you have sets and sorted sets on the sets you can be intersection between things alone. and then you have high blog long which is used to count really really a large amount of things so you need to count the a number of uniqueness. and then you can also do in the years but she also just have a winner this year. we use this and then you have a new a script was sorry region takes on that one so you can execute script on the server itself are its and the atomic operation. since your and running read this of a single for the only one thing can happen on the time and that gives you sort of the protection so don't need to think about transactions just if you wrap it in the lucrative will run in that sequence the scripts can be uploaded to the server and you just call them are calling a hash of them. and as i cave use it for the now playing the data. we keep the. the sort of non-payment of use a sort of set and then keep the song i learned that a new house sets the and two and an item to use the loo a script. the were we. how much an ally the begin in the program the id for the care and song. when it starts home a the system data for it. and. the. how long to live in the. in the end the cash. so first be added to the sordid set or. for a child and then we added to the has set the distant data and then we heard expired items you don't want keep all the tracks in red is the only keep what is available in the libel for most teams. and i read it. a. just get the the. the sort of the list and then we look up to the elements and has set sort them. a word of caution if you're going to use no script. now if they get too big to take time and says read this is single truthers if you start using of time to read the server your cash will be slow to the bone quite good on that one as well. so then really see how all how much for tormenting our servers until things started to fail and that's not fun thing but to what experience alone. and you will get in rotas you can see universe performing script so you can log into service in command line and does not go slow blog where you can see the slowest scripts you have.
and that's it. yes it. between cars items are we have some. that's handled by your script. the survey to do it. this year it. so is so you can cast light bulbs does what we would take the object remained until i said told to some bites. but yes. you can choose not to just we had the object so when inches or less than that. thank you for coming. act of. the. it's not.
Feedback