Help me.... about net/http


#1

Hai All.

I have big problem in net/http… please help me…

  • In my application have net/http for send xml…
    my question => why my site only can handle one request??? so only one
    user
    can request to my server…??? if 2 user request… then the last user
    always wait or RTO…

I want in my application have one controller to check the other
controller
run or not (the xml run or not)
ex: controller a --> controller which send xml
controller b --> monitoring… for check the another
controller…
—> i wrote net/http for request controller a (on same server)… it
always will RTO… why??? if other server… always ok… :frowning:

Please help me
Thank you very much


Wu You Duan


#2

Rails is single threaded, it processes one request at a time.
Unless you are using nginx/mongrel cluster.

You can have any number of users, but having a server call itself is
not a good thing. You want to get out of the controller quickly, not
be waiting on something. What you might want to do is
to queue the work to a “worker” thread, and let the worker run in the
background.

In Windows you can do a “service” that will do the work for you.
Or a Daemon in Linux. Then you simply queue the work to the background
server, it can be as simple as putting a record in a table, and having
the daemon
watch for it.

Then its easy to look up and see what is going on.

Also this is good practice if you have a long running process.

You can also use rufus-scheduler to schedule background activity.

If you need some help feel free to ask.

http://mentalpagingspace.blogspot.com