6

I got terrible problem with Laravel http request. Please help me to solve this:

I assumed that I have 2 requests that route to same Controller:

When I fired Req 1 then next is Req 2. I just think that 2 Reqs are separately, means Req 1 and Req 2 run in their own way. But the result I got was Req 2 could not finish when Req 1 was running.

In controller,

  • Req 1: I want to run script to parse HTML file with yangqi/htmldom
  • Req 2: I want to return some simple value.

Edited: My question is why my Req 2 has to wait Req 1 finish first? They should not depend on each other, i think? Or some problem with Laravel.

Thanks for your support,

2
  • Can you edit your text so it has clear question in it that we can answer? Right now I am not entirely sure what you want to accomplish. Commented Apr 22, 2015 at 7:46
  • Edited, Could you please help me on this? @smartman Commented Apr 22, 2015 at 8:03

1 Answer 1

2

Looks like you are using default local synchronous queue driver. To get parallel processing capability you need to use some other driver. I recommend iron.io

More info from http://laravel.com/docs/5.0/queues#configuration

Sign up to request clarification or add additional context in comments.

7 Comments

You mean laravel server in local cannot handle parallel processing? How about server in host, ex: byethost,etc..? Do we need to configure anything?
It depends on your config. Sync driver means that tasks are processed in sequence. Other drivers support also parallel processing. The link I gave you explains how to use different queue drivers that you can configure in your config/queue.php
1 more question, how can I execute function by Req 1 in background (thread)? Can you give me some hint?
I recommend to use iron queue driver iron.io/mq for parallel processing. I have been using it and it works like a charm. However in localhost you need to create publicly accessible tunnel so that calls made from iron.io servers reach your application. You can also try database driver.
Thanks all. But I still have some confusion. Before that, I just think that in default server will handle requests parallel, separately, not single thread like this, I think every incoming request will work in their thread only? Am I correct?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.