Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Dependency tree built

Thanks Simone. 

Because of not adding the callback.succeed(). I cannot see the detail result before,resulting in my confusing. Sorry for it.

The thing I want to do is to use the priority to block the resource I want to get. For example my childpath here:

 A:   childpath.add("img/clink/clinklittle128.png");

 B:   childpath.add("js/preloadjs.min.js");

 C:   childpath.add("index.html");         

 D:  childpath.add("css/infocard.css");

And I build a tree 

      A

       |   

      C

   /       \

B          D

A is a really big file while C is a big file but smaller than A. I hope A is large because it may cost much time for transporting then the client may wait a very long time to get B , C , D(that is what I am interested, some server's performance may be degraded because of the priority). But the result shows that the order finished is B,D,C,A (while my request order is A,B,C,D). Maybe that is because of flow control(I guess so). 

And if I do not use the the  priority. The finished order still remains B,D,C,A. Then how can I know whether the server complete the priority logic and where the pros of priority are.

But when they are both small files. The result goes as the priority order(So I think client part is okay for priority sending).

Best Regards

Muhui Jiang



2015-09-18 17:21 GMT+08:00 Simone Bordet <sbordet@xxxxxxxxxxx>:
Hi,

On Fri, Sep 18, 2015 at 8:51 AM, Muhui Jiang <jiangmuhui@xxxxxxxxx> wrote:
> Hi
>
> If I just remove all the override part. The results seems not the same.
>
>     childpath.add("img/clink/clinklittle128.png");
>
>     childpath.add("js/preloadjs.min.js");
>
>     childpath.add("index.html");
>
>     childpath.add("css/infocard.css");
>
>
>      session.newStream(new HeadersFrame(metaDataA, null, true), new
> Promise<Stream>()
>
>     {
>
>         @Override
>
>         public void succeeded(Stream stream)
>
>         {
>
>             // Now we have the streamId.
>
>             int streamIdA = stream.getId();
>
>             System.out.println(streamIdA);
>
>             MetaData.Request metaDataB = new MetaData.Request("GET", new
> HttpURI("https://"+host+":"+port+"/"+childpath.get(1)), HttpVersion.HTTP_2,
> requestFields);
>
>             session.newStream(new HeadersFrame(metaDataB, new
>
>     PriorityFrame(streamIdA, 1, false), true), new
>
>     Promise.Adapter<>(), new Stream.Listener.Adapter()    );
>
>             MetaData.Request metaDataC = new MetaData.Request("GET", new
> HttpURI("https://"+host+":"+port+"/"+childpath.get(2)), HttpVersion.HTTP_2,
> requestFields);
>
>             session.newStream(new HeadersFrame(metaDataC, new
>
>     PriorityFrame(streamIdA, 256, true), true), new
>
>     Promise.Adapter<>(), new Stream.Listener.Adapter() );
>
>             MetaData.Request metaDataD = new MetaData.Request("GET", new
> HttpURI("https://"+host+":"+port+"/"+childpath.get(3)), HttpVersion.HTTP_2,
> requestFields);
>
>             session.newStream(new HeadersFrame(metaDataD, new
>
>     PriorityFrame(streamIdA, 1, false), true), new
>
>     Promise.Adapter<>(), new Stream.Listener.Adapter() );
>
>        }
>
>
> @Override
>
> public void failed(Throwable x) {
>
> // TODO Auto-generated method stub
>
> }
>
>     }, new Stream.Listener.Adapter()
>
>
>
>     );
>
>
> Weights and exclusive has no influence on the results. My server logs keeps
> this order
>
> 127.0.0.1 - - [18/Sep/2015:14:48:22 +0800] "GET /index.html HTTP/2" 200 8215
> "-" "org.eclipse.jetty.http2.client.HTTP2Client/9.3.4-SNAPSHOT"
>
> 127.0.0.1 - - [18/Sep/2015:14:48:22 +0800] "GET /css/infocard.css HTTP/2"
> 200 2800 "-" "org.eclipse.jetty.http2.client.HTTP2Client/9.3.4-SNAPSHOT"
>
> 127.0.0.1 - - [18/Sep/2015:14:48:22 +0800] "GET /js/preloadjs.min.js HTTP/2"
> 200 30839 "-" "org.eclipse.jetty.http2.client.HTTP2Client/9.3.4-SNAPSHOT"
>
> 127.0.0.1 - - [18/Sep/2015:14:48:22 +0800] "GET
> /img/clink/clinklittle128.png HTTP/2" 200 2318863 "-"
> "org.eclipse.jetty.http2.client.HTTP2Client/9.3.4-SNAPSHOT"
>
>
> Do you know why?

There is a disconnect between the code you show, what you expect it
happens and what the server does.
Your code above says that at childpath[2]==index.html, so you are
probably asking it twice.

You have also to realize that it takes some time for the frames to be
sent, so it may be that your server has already fully processed the
request before it can reason about priorities.
Also, what the server prints in its logs may not in the same order of
the received frames, or processed requests.

I still don't understand what you are trying to do.

If you are trying to request A, then B, then C with a bigger weight
than B, then ask C first and then B.
You don't need priorities.

If you want to exercise priorities, you have to make B a really large
file that takes time to be sent back, so that C has the time to arrive
to the server, be priority-processed, so that the server pauses B to
send C.

If you override onData(), you have to make sure to call succeed() on
the callback, otherwise the client will stop reading from the socket
(after a while).

Please state exactly what you want to achieve, and what the problem is.

Thanks !

--
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top