For those who are still following along, these are the lines in question:

https://github.com/Miserlou/django-zappa/blob/master/django_zappa/handler.py#L31
https://github.com/Miserlou/django-zappa/blob/master/django_zappa/handler.py#L68

It's very possible there are ways of significantly improving this. 
Suggestions always welcome!

R

On Monday, February 29, 2016 at 11:26:17 PM UTC+1, Rich Jones wrote:
>
> Hey all!
>
> Let me clarify a few of the terms here and describe a bit how Django 
> operates in this context.
>
> "Serverless" in this contexts means "without any permanent 
> infrastructure". The server is created _after_ the request comes in, and it 
> dies once the response is returned. The means that we never have to worry 
> about server operations or horizontal scalability, and we pay far, far far 
> less of a cost, as we only pay for server time by the millisecond. It's 
> also radically easier to deploy - a single 'python manage.py deploy 
> production' gives you an infinitely scalable, zero-maintenance  app. 
> Basically, Zappa is what comes after Heroku.
>
> To do this, we use two services - Amazon Lambda and Amazon API Gateway.
>
> The first, AWS Lamdba - allows us to define any arbitrary function, which 
> Amazon will then cache to memory and execute in response to any AWS system 
> event (S3 uploads, Emails, SQS events, etc.) This was designed for small 
> functions, but I've been able to squeeze all of Django into it.
>
> The other piece, API Gateway, allows us to turn HTTP requests into AWS 
> events - in this case our Lambda context. This requires using a nasty 
> language called 'VTL', but you don't need to worry about this.
>
> Zappa converts this API Gateway request into a 'normal' Python WSGI 
> request, feeds it to Django, gets the response back, and performs some 
> magic on it that lets it get back out through API Gateway.
>
> You can see my slides about this here: 
> http://jsbin.com/movecayuba/1/edit?output
> and a screencast here: https://www.youtube.com/watch?v=plUrbPN0xc8
>
> Now, this comes with a cost, but that's the trade off. The flip side is 
> that it also means we need to call Django's 'setup()' method every time. 
> All of this currently takes about ~150ms - the majority of which is spent 
> setting up the apps. If we could do that in parallel, this would greatly 
> increase the performance of every django-zappa request. Make sense?
>
>
>
> *We also have a Slack channel <https://slackautoinviter.herokuapp.com/> 
> where we are working on this if you want to come by! *R
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/eee4285f-243b-494a-ae20-7678c8d4cb7c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to