Re: Database connection retry

2017-03-02 Thread Aymeric Augustin
Hello James,

If I understand correctly, the problem is that runserver fails to boot because 
it cannot perform checks, some of which connect to the database (e.g. the check 
that all migrations were run).

Is that what you're talking about?

I suppose the fix involves something like:

while True:
try:
perform_system_checks()  # I made this up
except Exception:
log_exception()  # ditto
time.sleep(1)
else:
break

Assuming the exception is clearly reported, that would be more 
beginner-friendly, which is a design goal of runserver. I think it's worth 
exploring, provided it doesn't create too much complexity.

Best regards,

-- 
Aymeric.



> On 1 Mar 2017, at 21:59, James Pic  wrote:
> 
> Hi all,
> 
> It seems like runserver won't retry to connect to the database after a 
> failing connection. Once the db server is up, it looks like I have to restart 
> runserver manually.
> 
> If this is correct, may I suggest that we make runserver retry connecting to 
> the database if it fails ?
> 
> Thanks
> 
> -- 
> 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/CAC6Op19Q3nGUU1wCCsmdJbHhUvqEuaS-wNc9htAE1QXLQocsBw%40mail.gmail.com
>  
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 
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/7F4FC0B0-8A47-4219-83FC-978A37F10D84%40polytechnique.org.
For more options, visit https://groups.google.com/d/optout.


maximum number of connection using django-channels

2017-03-02 Thread Gopal
Hello everyone,
I am using django=1.10.5 and channels==1.0.3 in my project.
First i will give you little description about my project so that you all 
can understand my question properly.
I am getting latitude and longitude of android device(first user) using 
websockes. So that android application is connected to my django 
server(second user) through websocket (implemented using channels), and i 
am storing all latitude of longitude of all connected android devices using 
that app. After that i am sending all those locations to web browsers(third 
user). So basically i am taking location from android devices (or from 
first user), storing into server's database (or to second user) and showing 
those location to web browser (or to third user). They all are 
communicating using websocket. Now my question is how many clients or user 
can connect to that websocket and does number of connections depend upon 
free ports or does it depend on RAM and second question is that can some 
one explain in detail from OS perspective that how does django-channel 
works ???

-- 
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/a9cd7ffd-0f69-4aff-b6c2-8ae4bf9df091%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: maximum number of connection using django-channels

2017-03-02 Thread Andrew Godwin
Hi,

There's more about how Channels works in the docs and in talks I've given,
but the short version is:

* Websockets go into a server called Daphne, which is written in Twisted
and so can handle hundreds or potentially thousands of simultaneous
connections open at once
* Any event on a websocket (connect, message received) is sent onto the
channel layer, which is a type of first-in-first-out queue
* Django worker processes synchronously take a message from the queue,
process it, and then loop back to take another

Thus, there are two factors to scaling:
* The number of open connections affects how many Daphne instances you run
* The throughput of events affects the number of workers you run

For example, if you had 1 clients connecting but sending one message
every few minutes, you'd want 10 Daphne instances but only a few workers.
If you had 100 clients sending 10 messages a second, you'd only need one
Daphne instances but lots of workers.

The number of connections Daphne can take depends on a combination of CPU
speed and kernel limits; it's not going to be RAM-limited except on very
low memory systems.

Hope that helps.

Andrew

On Wed, Mar 1, 2017 at 10:01 PM, Gopal  wrote:

> Hello everyone,
> I am using django=1.10.5 and channels==1.0.3 in my project.
> First i will give you little description about my project so that you all
> can understand my question properly.
> I am getting latitude and longitude of android device(first user) using
> websockes. So that android application is connected to my django
> server(second user) through websocket (implemented using channels), and i
> am storing all latitude of longitude of all connected android devices using
> that app. After that i am sending all those locations to web browsers(third
> user). So basically i am taking location from android devices (or from
> first user), storing into server's database (or to second user) and showing
> those location to web browser (or to third user). They all are
> communicating using websocket. Now my question is how many clients or user
> can connect to that websocket and does number of connections depend upon
> free ports or does it depend on RAM and second question is that can some
> one explain in detail from OS perspective that how does django-channel
> works ???
>
> --
> 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/a9cd7ffd-0f69-4aff-b6c2-
> 8ae4bf9df091%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAFwN1upsntV_osy6URNxyiJxgx7VxBb1AcVDzaKPNY4HeM0MUQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.