Yes Evgeny you're right.. I just installed ubuntu-server 11.10 with python
2.7, and this problem is gone.

However my uwsgi process still take high CPU usage but I think it's
something else than python/django.


On 11 November 2011 09:03, Evgeny Turnaev <[email protected]> wrote:

> 2011/11/8 Xi Chen <[email protected]>:
> >
> >
> > On 8 November 2011 08:31, Evgeny Turnaev <[email protected]> wrote:
> >>
> >> 2011/11/7 Xi Chen <[email protected]>:
> >> > I have checked my uwsgi process strace again, and found too many this:
> >> > send(19, "POST /v1/alternative.cgi HTTP/1.1"..., 198, 0) = 198
> >> > poll([{fd=19, events=POLLOUT}], 1, 1000) = 1 ([{fd=19,
> >> > revents=POLLOUT}])
> >> > send(19, "{\"visitor\": \"82d6d2b773b9eab8bdd7"..., 123, 0) = 123
> >> > poll([{fd=19, events=POLLIN}], 1, 1000) = 1 ([{fd=19,
> revents=POLLIN}])
> >> > recv(19, "H"..., 1, 0)                  = 1
> >> > poll([{fd=19, events=POLLIN}], 1, 1000) = 1 ([{fd=19,
> revents=POLLIN}])
> >> > recv(19, "T"..., 1, 0)                  = 1
> >> > poll([{fd=19, events=POLLIN}], 1, 1000) = 1 ([{fd=19,
> revents=POLLIN}])
> >> > recv(19, "T"..., 1, 0)                  = 1
> >> > poll([{fd=19, events=POLLIN}], 1, 1000) = 1 ([{fd=19,
> revents=POLLIN}])
> >> > recv(19, "P"..., 1, 0)                  = 1
> >> >
> >> > Looks like instead of recieve entire http header, but receive only one
> >> > byte
> >> > at a time. Because I call many other external webservices, this could
> >> > cause
> >> > tons of recv syscalls.
> >> > Really no clue why it only recv 1 byte. I have checked sysctl and
> seems
> >> > pretty fine.
> >> > Any ideas?
> >>
> >> I heard python urllib reads http headers by 1 byte. That will be a lot
> >> of recv(1)
> >> if one have a lot of connections. Don`t know if this fixed/not fixed
> >> but searching in google confirms rumors.
> >> Althrough i can`t find recv(1) in python urllib. You can confirm this
> >> doing just urllib fetching without uwsgi and stracing.
> >>
> >
> > I have just tried on my ubuntu desktop using urllib, urllib2. HTTP
> headers
> > can be recv'd:
> > recv(3, "HTTP/1.1 200 OK\r\nContent-Type: a"..., 8192, 0) = 277
> > But the same code (same python ver also) I move to Debian lenny
> production
> > server, it becomes
> > recv(19, "H"..., 1, 0)                  = 1
> > recv(19, "T"..., 1, 0)                  = 1
> > recv(19, "T"..., 1, 0)                  = 1
> > It seems only occur when I make a POST request to external webservice,
> and
> > only http header cannot be read entirely. Really frustrating.
>
> Hmm.. pretty strange. Are you sure python version matches including
> minor subversion?
> If it works in ubuntu maybe it is fixed in latest python - you can
> compile latest python from source
> and test it.
>
> > uWSGI mailing list
> > [email protected]
> > http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
> >
> >
>
>
>
> --
> --------------------------------------------
> Турнаев Евгений Викторович
> +7 906 875 09 43
> --------------------------------------------
> _______________________________________________
> uWSGI mailing list
> [email protected]
> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
>
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to