Asynchronous network requests in a web application

Video thumbnail (Frame 0) Video thumbnail (Frame 952) Video thumbnail (Frame 1874) Video thumbnail (Frame 2518) Video thumbnail (Frame 3456) Video thumbnail (Frame 4138) Video thumbnail (Frame 5009) Video thumbnail (Frame 6012) Video thumbnail (Frame 6677) Video thumbnail (Frame 7569) Video thumbnail (Frame 8680) Video thumbnail (Frame 9623) Video thumbnail (Frame 12612) Video thumbnail (Frame 13790) Video thumbnail (Frame 14529) Video thumbnail (Frame 16014) Video thumbnail (Frame 17504) Video thumbnail (Frame 18488) Video thumbnail (Frame 19812) Video thumbnail (Frame 20590) Video thumbnail (Frame 22161) Video thumbnail (Frame 23008) Video thumbnail (Frame 23950) Video thumbnail (Frame 24649) Video thumbnail (Frame 25544) Video thumbnail (Frame 26428) Video thumbnail (Frame 27425) Video thumbnail (Frame 28089) Video thumbnail (Frame 29146) Video thumbnail (Frame 30250) Video thumbnail (Frame 31591) Video thumbnail (Frame 32742) Video thumbnail (Frame 33597) Video thumbnail (Frame 34346) Video thumbnail (Frame 35306) Video thumbnail (Frame 36182) Video thumbnail (Frame 37196) Video thumbnail (Frame 37833) Video thumbnail (Frame 39323) Video thumbnail (Frame 40170) Video thumbnail (Frame 41515) Video thumbnail (Frame 42605) Video thumbnail (Frame 44801) Video thumbnail (Frame 45602) Video thumbnail (Frame 46711) Video thumbnail (Frame 48393)
Video in TIB AV-Portal: Asynchronous network requests in a web application

Formal Metadata

Title
Asynchronous network requests in a web application
Title of Series
Part Number
78
Number of Parts
169
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
Lauris Jullien - Asynchronous network requests in a web application Introducing asynchronous calls from within an endpoint in a web app can be desirable but hard to achieve. This talk will explore different solutions for this (running Twisted event loop, Co-Routines, Asyncio, …) and how well they play with the different parallelization models of common WSGI web servers. ----- In the more and more popular SOA paradigm, it’s common for services to have to compose responses with resources from many different services. Everyone’s first idea will probably be to call each service synchronously with your favorite python HTTP library. This unfortunately doesn’t scale well and tens of successive network calls will make your endpoints painfully slow. One solution is to parallelize these network calls. If you are already using an asynchronous web app (such as Tornado or Twisted), more asynchronous in your asynchronous shouldn’t be much of a challenge. But if you chose not to dive into the madness of chained Deferred calls, and used a standard prefork/threaded WSGI web server (such as Gunicorn or uWSGI) to run your Django/Flask/Pyramid application, you might find yourself wondering how to manage these asynchronous calls. This talk will explore different solutions (running Twisted event loop, Co-Routines, Asyncio, …) and how well they play with the different parallelization models of WSGI web servers.
Loading...
Meeting/Interview Bayesian network Physical law Cartesian coordinate system World Wide Web Consortium
Mobile Web Computer animation Software Synchronization Server (computing) Orientation (vector space) Code Bit Replication (computing) Statistics
Point (geometry) Service (economics) Computer animation View (database) Different (Kate Ryan album) View (database) Energy level Endliche Modelltheorie Replication (computing) Code
Service (economics) Service (economics) Computer animation Multiplication sign
Web page Service (economics) Service (economics) Thread (computing) Concurrency (computer science) Multiplication sign Total S.A. Thread (computing) Dimensional analysis Virtual machine Number Protein folding Number Process (computing) Computer animation Software Personal digital assistant Synchronization Befehlsprozessor Synchronization Revision control Summierbarkeit Reading (process) Condition number
Concurrency (computer science) Limit (category theory) Thread (computing) Computer programming Virtual machine Power (physics) Web application Number Computer animation Atomic number Befehlsprozessor Revision control Local ring
Mobile app Run time (program lifecycle phase) Computer animation Student's t-test Software maintenance Event horizon Position operator Sinc function
Mobile app Server (computing) Thread (computing) Symbol table Product (business) Data model Event horizon Computer animation Lecture/Conference Computer configuration Endliche Modelltheorie Loop (music) Pressure
Mobile app System call Thread (computing) Multiplication sign Virtual machine Coprocessor Data model Semiconductor memory Proxy server Pressure Form (programming) Mobile app Standard deviation Dependent and independent variables Gateway (telecommunications) Server (computing) Cartesian coordinate system System call Flow separation Category of being Process (computing) Computer animation Integrated development environment Software Phase transition Right angle
Email System call Thread (computing) Multiplication sign Insertion loss Disk read-and-write head Semiconductor memory Interpreter (computing) Physical law Process (computing) Noise Scripting language Source code Web page Computer file Stress (mechanics) Bit Thread (computing) Virtual machine Fault-tolerant system Process (computing) Hardy space Asynchronous Transfer Mode Server (computing) Graphics tablet Maxima and minima Directory service Limit (category theory) 2 (number) Revision control Summierbarkeit Default (computer science) Mobile app Operations research Raw image format Online help Server (computing) Core dump Computer network Euler angles Coprocessor Limit (category theory) System call Single-precision floating-point format Number Algebra Computer animation Software Network socket Revision control Address space
Email Asynchronous Transfer Mode System call Dependent and independent variables Line (geometry) Directory service Complete metric space Limit (category theory) Icosahedron Area Goodness of fit Read-only memory Befehlsprozessor Interpreter (computing) Process (computing) Website Local ring Default (computer science) Operations research Mobile app Metropolitan area network Online help Server (computing) Computer file Web page Computer network Core dump Coma Berenices Maxima and minima Bit Euler angles Thread (computing) Virtual machine Number Fault-tolerant system Process (computing) Error message Algebra Computer animation 4 (number) Network socket Synchronization Revision control Exception handling Task (computing) Address space
Point (geometry) Revision control Mobile app System call Thread (computing) Process (computing) Computer animation Lecture/Conference Right angle Process (computing) Thread (computing) Power (physics)
Mobile app Service (economics) Dependent and independent variables Client (computing) Bit Rule of inference System call Word Process (computing) Computer animation Software Lecture/Conference Universe (mathematics) Synchronization Process (computing) Loop (music) Library (computing)
Asynchronous Transfer Mode Mapping System call Graphics tablet Dependent and independent variables Structural load Length Dot product Line (geometry) Maxima and minima Directory service Complete metric space Limit (category theory) Student's t-test Disk read-and-write head Read-only memory Befehlsprozessor Interpreter (computing) Process (computing) Maize Summierbarkeit Maß <Mathematik> Default (computer science) Mobile app Source code Operations research Scaling (geometry) Server (computing) Computer file Web page Coma Berenices Computer network System call Thread (computing) Virtual machine Number Fault-tolerant system Error message Algebra Computer animation Network socket Synchronization Revision control 5 (number) Exception handling Task (computing) Address space
Email Asynchronous Transfer Mode Server (computing) System call Dependent and independent variables Line (geometry) Multiplication sign Different (Kate Ryan album) Interpreter (computing) Energy level Process (computing) Summierbarkeit Local ring Traffic reporting Default (computer science) Operations research Mobile app Computer icon Execution unit Online help Server (computing) Computer file Magneto-optical drive Interior (topology) Parallel port Computer network Core dump Thread (computing) Fault-tolerant system Algebra Error message Computer animation Network socket Synchronization Revision control Exception handling Address space
Email System call Thread (computing) Quantum state Dependent and independent variables Line (geometry) Multiplication sign Image resolution Maxima and minima Mereology Event horizon Number Direct numerical simulation Mathematics Summierbarkeit Loop (music) Metropolitan area network Mobile app Computer file Ext functor Computer network Core dump Coma Berenices Client (computing) Bit Euler angles Thread (computing) Error message Computer animation Synchronization
Broadcast programming Mobile app System call Computer program Computer programming Computer programming Leak Crash (computing) Loop (music) Event horizon Computer animation Normed vector space Synchronization Convex hull Conditional-access module Loop (music) Resultant Physical system
Email System call Thread (computing) Befehlsprozessor Interpreter (computing) Process (computing) Endliche Modelltheorie Website Pairwise comparison Source code Computer file Web page Thread (computing) Virtual machine Fault-tolerant system Process (computing) Computer configuration Task (computing) Point (geometry) Asynchronous Transfer Mode Mapping Sequel Dependent and independent variables Line (geometry) Image resolution Directory service Limit (category theory) Event horizon Wave packet Loop (music) Default (computer science) Mobile app Operations research Execution unit Gateway (telecommunications) Online help Image resolution Server (computing) Core dump Computer network Coma Berenices Number Error message Computer animation Network socket Synchronization Revision control Exception handling Address space
Revision control Mobile app Mathematics Mapping Computer animation Image resolution Lecture/Conference Synchronization Set (mathematics) Pairwise comparison Thread (computing)
Mobile app Event horizon Computer animation Commitment scheme Cuboid Library (computing)
Asynchronous Transfer Mode Implementation System call Table (information) Dependent and independent variables Line (geometry) Connectivity (graph theory) Maxima and minima Complete metric space Event horizon Value-added network Computer configuration Interpreter (computing) Process (computing) Local ring Default (computer science) Mobile app Computer icon Rule of inference Operations research Server (computing) Web page Computer file Cartesian coordinate system Thread (computing) Number Fault-tolerant system Process (computing) Event horizon Error message Computer animation Software Network socket Synchronization Partial derivative Lipschitz-Stetigkeit Exception handling Task (computing) Electric current Library (computing) Wide area network Address space
Reading (process) Email Asynchronous Transfer Mode Mapping System call Graphics tablet Thread (computing) Dependent and independent variables Line (geometry) Image resolution Multiplication sign MIDI Complete metric space Number Pointer (computer programming) Interpreter (computing) Process (computing) Local ring Default (computer science) Mobile app Operations research Default (computer science) Server (computing) Computer file Magneto-optical drive Interior (topology) Computer network Core dump Coma Berenices Thread (computing) Fault-tolerant system Event horizon Error message Computer animation Network socket Synchronization Revision control Exception handling Task (computing) Address space
Email System call Thread (computing) Concurrency (computer science) Hecke operator Special unitary group Arm Bulletin board system Different (Kate Ryan album) Interpreter (computing) Object (grammar) Process (computing) Local ring Computer file Ext functor Bit Thread (computing) Fault-tolerant system Process (computing) Task (computing) Surjective function Asynchronous Transfer Mode Perfect group Dependent and independent variables Line (geometry) Maxima and minima 3 (number) Number Summierbarkeit Loop (music) Hydraulic jump Default (computer science) Operations research Mobile app Suite (music) Server (computing) Magneto-optical drive Core dump Computer network Client (computing) Coroutine CAN bus Event horizon Error message Computer animation Network socket Revision control Synchronization Key (cryptography) Exception handling Address space
Email System call Concurrency (computer science) Line (geometry) Multiplication sign Maxima and minima Bit Theory Lecture/Conference Computer network Physical law Summierbarkeit Loop (music) Cone penetration test Torus Computer file Physicalism Core dump Computer network Thread (computing) CAN bus Curvature Process (computing) Event horizon Computer animation Personal digital assistant Quicksort Exception handling Task (computing)
Proof theory Process (computing) Event horizon Computer animation Image resolution String (computer science) Phase transition Maxima and minima Event horizon Local ring Resultant
Regulärer Ausdruck <Textverarbeitung> Thread (computing) Event horizon Flow separation Computer animation Software Stress (mechanics) Cartesian coordinate system Flow separation Event horizon Loop (music) Thread (computing)
Logical constant Raw image format Presentation of a group Dependent and independent variables Functional (mathematics) Regulärer Ausdruck <Textverarbeitung> Thread (computing) Graph (mathematics) Ferry Corsten Concurrency (computer science) Forcing (mathematics) Bit Flow separation Thread (computing) Event horizon Flow separation Computer animation Software Lecture/Conference Computer configuration Extension (kinesiology) Loop (music)
Revision control Event horizon Flow separation Computer animation Software Concurrency (computer science) Cartesian coordinate system Family Loop (music) Thread (computing) Resultant
Ocean current Concurrency (computer science) Multiplication sign Interior (topology) Bit Distance Cartesian coordinate system System call Thread (computing) Pointer (computer programming) Loop (music) Flow separation Event horizon Computer animation Computer configuration Loop (music) Resultant
Software engineering Email Asynchronous Transfer Mode System call Closed set Line (geometry) Dot product Network operating system Maxima and minima Directory service Electronic mailing list Read-only memory Lecture/Conference Interpreter (computing) Befehlsprozessor Process (computing) Website Local ring Summierbarkeit Loop (music) Default (computer science) Socket-Schnittstelle Mobile app Rule of inference Source code Operations research Gateway (telecommunications) Online help Server (computing) Computer file Web page Core dump Computer network Cartesian coordinate system Thread (computing) Mathematics Number Fault-tolerant system Length of stay Event horizon Algebra Computer animation Network socket Revision control Social class Exception handling Task (computing) Address space
Email Asynchronous Transfer Mode System call Mapping Dependent and independent variables Line (geometry) Multiplication sign Maxima and minima Complete metric space Electronic mailing list Computer font 2 (number) Pointer (computer programming) Interpreter (computing) Process (computing) Local ring Default (computer science) Operations research Mobile app Online help Server (computing) Computer file Magneto-optical drive Computer network Core dump Ext functor Thread (computing) Category of being Fault-tolerant system Error message Algebra Computer animation Network socket Synchronization Revision control Exception handling Task (computing) Address space
Email Reading (process) System call Thread (computing) Dependent and independent variables Line (geometry) Frustration Complete metric space Flow separation Semiconductor memory Local ring Loop (music) Scaling (geometry) Computer file State of matter Stress (mechanics) Computer network Core dump Euler angles Thread (computing) Error message Computer animation Synchronization Key (cryptography) Exception handling Task (computing)
Loop (music) Event horizon Computer animation Lecture/Conference Computer network Computer network Computer network Coma Berenices Event horizon Loop (music) Library (computing) Product (business)
Point (geometry) Logical constant Presentation of a group Mobile app Concurrency (computer science) Image resolution Concurrency (computer science) Image resolution Multiplication sign Code Coma Berenices Mereology Event horizon Connected space Direct numerical simulation Computer animation Curve fitting Library (computing)
Computer animation 1 (number) Coma Berenices
Computer animation Meeting/Interview Library (computing)
Group action Thread (computing) Multiplication sign Electronic mailing list Stress (mechanics) Lattice (order) Instance (computer science) Cartesian coordinate system Mereology Twitter Process (computing) Software Right angle Resultant Mathematical optimization
Human migration Standard deviation Computer configuration Bit Event horizon Library (computing)
Presentation of a group Vector space Different (Kate Ryan album) Planning Student's t-test
Computer animation
Isabella come loose union reverses the back and something engineer guilt
in Hamburg and represent us to talk about his inference network is requested by the applications did walmart companies alright
thanks a lot for all of you being
here um sickness this request and will altercation with 1st I work for young an awesome some company where connecting people was great local businesses the laws you to find what is interesting around you restaurants all tails cinema everything we have a
90 million monthly active users just formal mobile of 102 millions review In total 70 % of all traffic such come from mobile so we're very mobile oriented company and launch inserted to countries including Spain what is this
talk about the 1st on going to introduce a bit why would you why did I do this for what's the problematic and what's actually not so easy about wanting to do a synchronous network in replication will do a quick reminder about that
was the point of view is the what's report model and wielding into wants and needs and of this talk some coding examples some way different ways to do this I'm might skim over many details and the goal is to have an overview of different ideas on how you can use this before progressed in replications what's so use answer is on the up that's what I'm working on and we
have a service which is the the available and from very high level people request on your services but that's a very very high level view and that's not really what it looks like you know and so on and so what many people do
is they have an insulator 1st it's fine equally efficient service you call your business so as you call your use the service and its or reduced slow and it gets smaller and smaller as much as yet services and the user are just waiting for the phone which you don't really want to them answers so you what you might
want to do if you can do is just call all of the services at the same time and that's where
they are not as your total time spending for your public service endpoint is not the sum of all the all the services you have to call but
just page what the soloists and that's going to be a timing we are all doing Python Standard Library contains
most of the 2 we need for everything and there is a very nice thing which is the central executive i've taking copy-pasted since from the documentation example is exactly evolved during a synchronous network requests it's very nice it's what you should be doing using processes but case threads are very nice as I'm reading from the conditions for it was is often used a lot higher which is exactly what we we want to do and there is also another mention which is will the folds and number of processing dimensions defined fight and that's kind of where
things going to watch some problems solarise which is we don't run just 1 Python program were running away replication and of all this whole web application to run and as much was possible in as much politics of atoms in your request as it possibly
can and right now the ThreadPoolExecutor is going to be concurrent with this and also it means that there is only a sentence limits and which it can serve request right now it's going to be the local emission terbinafine this means if you want to do 1 more request it's not going to be executed between power also is not aimed to break I'm going to do small
little things about justifying what people about if you're running time needed students this kind of invented out or even something is directly plugged into G event that's not exactly is the position I'm going to take your maintenance lots of single the room but since I'm going to focus on the reason have
because what's what Django pyramid fast that all are fundamentally it's fairly
unlikely that you'll deploying you all with the out with we use a symbol server all they should be simple so so we also need to choose a deployment options
just for the sake of talking about things that work across today uh other reusing URIs day because it's you very used in production there is a lot of
options you can do almost everything and it's using the pre-fault model which is what's most efficient to run whatsoever so if you don't know what to the that didn't stop that
please call so you have the master processor work process which is going to build your app then going to to creates the workers and then create going to run your application in several rights threats that's really really nice because the fork as a property of being copy on right which means that you will save all the memory for this process is just going because they are all the same will come back to that and when you want to serve request later you have something rest proxy initiative worker using you is the and you must process is reporting requests to workers into the threat call no 1 looks too badly injured right now that's the
simple as simple solution to do what we wanted it's completely synchronous are not even more using the thread pool is going to be all of phase of affection for everything that's happening you application which takes the environment and not response which is the basic of the was the standards we are using request forms network calls because it's way easier that way I avant my machine a small set of and running that is going to be just you give it a time waits for that time and respond and that's a very
nice simplification of long network calls that's from this
great is the that's the basic version which is going to run wants nothing too complicated but staged a stop to it and let's go forward so so is this loss this is supposed to last 1 . 5 25 seconds it left to be more because of the head and that's long very very long right now if I have a little script is allows me to a server and you'll see that it only serves 1 request at a time all this request are arriving in Paolo to who has 403 3 request is going to wait for 4 and a half seconds is going to be the exact some of the thing which is what we don't know what I'll just show quickly is running server In another version sorry so I prepare many but as I'm talking with much already which is going to run what's called the mixed with threads and processes uh palatization these against it a natural process that should not have too much memory but it still goes and using more more calls and threads uh you had a bit more memory because that's all I had that was gills and everything runs on the same process of course so is there is a limit to how much stress can run right now I'm using
Vienna for controlling this and actually 2 processes to spread is the maximum I can run because I made a very
very small sorry the various very small warm and that's Francis all the 1 with the next and you will see we can and yeah let's through for request that it and let's change the faults and yeah we waited a bit more than expected of ahead but still it's goods and the free throws with 1 then we're going to wait an awful lot longer because 1 of the request is waiting until the also are available it was created in minutes and something
right you can see that basically
whether you are processes or threads power lies in a very similar manner the notes on continued for forgetting it's so obvious all the current I'm going to present its points and 2 . 5 everything is made here with Python 2 . in mind I might tell you things are available for all the points and version but that's using in Python
it's nice it's good uh the right
through that's very simple let's try to do something a bit nicer still is going to be looking into the standard library when it when is available a a a single ionized again a very simple solution i'm going to use always you all my example was to processes there is a very good reason for that is as I was telling beginning there is a fork abusing service so many things can be a bit different when you have if you just run 1 you can not see everything from have here some strange thing happens because the whole process happens and something that would be so just just to be really clear that all words 2 processes that's going to be the rule here falls occurred is taken directly from um is there a university library for doing network calls if you do not know if this works it was a bunch of talk and this conference to know
how to do so and there is more again today go and see let's
run it I want you to go that
using student so that's that's attach a stop to it and we see homes threats what's happening there sorry from muttering French and let's scale it's just to prove that I actually did my job and prepare my silence occurred is actually working as I advised yes it's only lasted half a 2nd before the head and that's the length of the longest call in the pilot who wanted to do
victory and we can see something of a different as well which is like all the cost of that at the same time and at all in the same time that did happen in parallel we are so thrilled that uh in
the free trying to hammer again and this time I will remember to change the fault and let's wrote to request that it yeah everything's find whose report we waiting palatization on the with the server level is completely transparent there is really difference with what were doing before so this is nice you might have noticed looking at
H told that that all for new number of threads appear which we did not really expect or become foreign anyway and let's look at what they're doing look at a time
Bellini's under ingest resolution it's a little trick it little problem with is a experiences ThreadPoolExecutor to actually end-user DNS resolution and its you need to be aware of its because it could create a lot more threats you just looking at the current again there is 1 part which it's a bit more important than it seems it's as a that if you get event it's not as transparent and it seems that what we did is we kind of change will program run and so was very nice the and
schematics interest in network programming essential so on just to get so single stranded what we used to do in the single our system and what we're trying to do now is that the event-driven column so we're not waiting anymore we're just piling up piling up and everything is happening inside the loop which change the way of program run but schematic is but actually there is still a lot of holds
into this so results show my performance didn't crash so I don't this from little
points um if you tried to use the training model you will encounter problems because getting event you just change the name price spread you can go around this was a little trick we just sets the eventually you get and fails if you felt to gives the event of interest we create 1 and that's where you can run this thread which we can just prove right now and let me so this tiny sequel to which means there is we're back in the situation in which we couldn't initially to processes to spread the process and the assign prices will fall quest that it was the right holds yeah it works will also we
see that so are I suspect from within its resolution this is actually going to be a solved problem fairly soon as I I would is coming in and it's going to have resonance but political using the event
place the rest but right now it's still not available unstable version to use master version
of which DPI you built using the idea is to depend on to do that so called we need a lot of things and as Exxon mentioning we did change where are have run that maybe we could go a bit further than that and this
change also goes away the whole set of around and have everything because it seems to be really really nice and will will continue my bingo of using a synchronous firing price and we is G that and
so on uh which should made actually being was tornado twisted and I think I have in the gene out 2 main things
to notice we make it that's the standard library so it does not come out degree of of the box is the commitment we are changing further and further and further the same and New
yes and we pass the
option to use the G. events my cross-trading same gene and is not exactly and even tho it's a process is based on the nightmare of sorry Greenspan implementation
but for all purposes it's really behaves in the same way as us and how would and you might also notice that
the I didn't change anything of the network or it's exactly the same as the 1 in the synchronous application which is nice so we did catch the standard library for its again to process let's run it because great used in tells you what running lips components yeah it works and and I
forgot to attach myself
to the work you will see what I do that in a 2nd when you see the number of threads began yet again urge events from
stressed by default to the genus genus resolution no it's it happens uh if we try to hammer and again this is time this so let's put a lot more so I
had written 50 even call so this should be like the maximum number of we would expect forcing 50 g threads onto processes 100 OK but that's actually a bit more that's not 1 . 5 that's a bit smaller but that's due left this young girl know that's less and yeah OK let's do something in between as the gene that's the scaling happens in
a bit of a difference manner which is you don't get perfect performance than jump than a job you have a slew raised in the number of concurrent requests that you can except for an extra little cost and if we go like a ball what
specified then it jumps again you have a job but there is not like a flat theoretical Pacific arithmetic progressed I I did was the case with physical presence at the
request request there's some sort of ramp up an extra cost to running it so in that case we gain a lot of concurrency between lost the gain in timing so that we wanted and we completely off occasionally made everything
revolves around you events and Hey we we have all
the various so actually if you astray 1 of the process you can i can prove use that phase during the solution you can the locals getting result here and so yeah depend on how will you always reading Strings
and you you are changing everything and you might not want to do that what you want might want to do is keep your good all
application you don't want to deal with us Cairo because you believe you're going to mess it up you want the simplest solution possible and maybe just the network calls and all the rest because unlike you really want the minimal n there is a
last technique to use that and not ideas that I will present and that's offloading uh in the event of in separate thread and then interacting with the stress that we have resin having reverted back to the set political to in the beginning but rather than having
many many spreads just have 1 which does everything synchronously and then you interface current visits using the future extraction which comes and Andean is exactly made this this is a crude is a bit more
involving here I'm using tornado for because it makes in my school for presentation I will mention also the option just it's just wait hold your forces it's coming um real function that we create and extensions the eventual we make its and current reinforcement is constant spread false responders in separate thread we start of Argentina premature room Miner was the exits don't do that just makes the could nice and also makes presentation graph but there are better ways to do this so long network called becomes a bit more complicated because we need to pass the
results in the future and then you might be noting I'm using concurrent future and not answer
tornado future to family was NATO it's because we are not running things in the same spread and so we need the start a version of it great um the application is very very nice and we get an extra sings from being able to do this and other we can do something else right now Knowles example I've presented you were preparing all of your network calls and throwing them and
distance and then waiting for results by doing this kind of is what you can do is like OK I want this saying than in this 1 and then you block the result you want at the time you want and if you have seen which our some calls which are dependent on 1 another we need to call the business so as to get the idea of a business and income 2nd 1 that's might be really interesting for you that's what we're using account all of these reasons and right now I'm just sleeping 1
2nd that's run it miracle little saying you might notice an extra option here which is cool lazy apps and on forced to do because I'm cheating a bit if you do remember this application is loaded loaded and then fault and the problem was that is the i a loop is created right away when the current is important and that wouldn't work was a for mobile perfectly the
amusingly apps to avoid this behavior when that just supplies and stack is loaded then the fall happens and then the application is loaded everywhere equal 0 my mind
and was pools that's clearly yes 1 2nd is not so . 5 like usual because we wait 1 2nd but we just have 1 2nd everything up and in Palo
behind we are happy you only if we trying to hammer it we have the same kind of performance and was like called into from
yeah and property 3 which would 3 seconds which were given time to make initial fonts and we see only 2 spreads which is what we expected tornado
it's right there is no frustrates victory as in again also the scales in the exact same way
as the original with so that and that's very nice because the extra cost we have just extra stress but it's not really very
working thread what indoors is very mostly waiting so it does not impact performance much does not invite memory much and it's very very practical especially if you don't want to get too involved into a synchronous things you just want to try to find tutoring synchronously I should you
could you should really not be using in production but fortunately user on the few libraries it could be using if you run really interesting and offloading eventually crochet is a very very nice library its user twisted event loop and you can basically run anything in the reactor was
reactor offloaded it's very very nice and if you are just 1 thing a networking
parts of the although the library which is called the the might of heard all of if you want if different yesterday and use it is called final notes so it was very very short of I
violence I skimmed over many many things but what's the takeaway is here's what future needs if you have like a very if you need to handle many many a synchronous connections and you want something do events and have good for didn't go for do something that help you out but if you do not want to do it don't say what constants like I need to do this no there are many many solution to keep your app in the ladies and still get the performance remember the trading tradeoffs between speed of points and concurrency and the where of DNS resolution it's can really a problem and the pain from time to time we are
available everywhere I would really like to recommend engineering what it's really nice we publish
lots of articles interesting ones and we have a booth at which I will be later if you have more questions that I cannot answer right now we thank Yuri
marginally some for the storm that taking a couple questions about human it's lessons his for his her hands on Monday have question
why do you need to avoid
these threats witness you don't need to but it's the next best thing
that you don't you means like if you were you could also avoid enhanced-resolution altogether if I had written 1 . 7 and the local directly I would not be that obviously it's necessary it's more whole threats that are taking execute that could be just integrated more seamlessly into the rest related all that above and not only the library to read in the it was more surprised more surprising in a way that really completely bad and contributor of this we can avoid it Jim any more questions
that of hi not very tall and you what you were doing offloading to another inside of you with the but 1 of the things that you is that of mentation talk about is that when you activated threads it actually has to great deal and it doesn't if it doesn't allow trends which is strange but that's how it works have you thought about
running all the network calls being another processing and then get the results back so you don't have that I don't know if the trade is going to be a good or a terrible meeting we about it but actually you don't so actually a civil action you could also 20 itself closer to you is the end right announcement is the finale but you could also ask you risky to sponsor spread for you and that's where it would really be shared across whole of how the instances it's an optimization ties you is you is the which is that years he was before deployment and it's it's and you can do it if you want to but if you won't want to switch huge unicorn you want to switch to something else that means that you need to rewrite part of your application could and adults fall putting in a process you don't need to because it's all red actually doesn't do much what to do those most of the time is waiting and waiting and mice and that we don't all the fields of much so the goal is not a problem with the that also few things because it's been defined waiting list of things if that were to change to offer a lot more things in it maybe it would be worth it but as your firebombs most of the time stress is more efficient just on 1 year them think you any other
questions OK hi things for the stock and migration so GMM and and basically the main he meant adventures the standard library so that means that messes with internal and how we feel will it through survive to the next item releases um I'm
not going to be perfectly honest I I'm always a bit wary when you have to present library especially because that means that when you enter soaring speaking which of course and when you integrate with this uh also party libraries you have problems in event it's like need to use everything G vented and all that there is a standard in Python which is absent pyro I think as people are migrating to Python 3 things like events will disappear but people using Python 2 g then to sit and a dissolve really really good options some I would think it's going to go away but yeah my personal
opinion is it's not going to survive this entire the unless
like some huge improvement into the scandalous relies on a vector running the same way it's Greenspan and others in your improvement in that regard seems like you for this scenario should be more performance and the more someone in the back thank
you for that will move and thank you for the great to just a commentary on the questions that students and present principles is being worked on so that they have plans to you right maybe they in the room when erasing can only be when you have wonderfully vibrant to be consistent differences approaches thanks and more
questions thank you were mentioning this
Loading...
Feedback
hidden