Log in

View Full Version : dynamic resource server script (php): feedback wanted



traq
04-28-2012, 02:44 AM
Hi everyone,

I'm looking for feedback on a project: https://github.com/customanything/LDRS

Typically, a webpage will be linked to several resources, such as javascript and stylesheets, which all need to be requested by the browser before the page is "complete."

The sheer number of HTTP requests is usually a bigger "bottleneck" than the total size of the downloaded resources. Because of this, combining resources into a single file is considered good practice - but an individual webpage might not actually use all of it.

LDRS (Lightweight Dynamic Resource Server) allows webpage resources to be served via a single HTTP request. This allows your webpage/application to avoid the overhead of extra HTTP requests, but still retrieve only those resources that are actually needed.

Thanks in advance. Comments and questions are encouraged, either here or by email.

LDRS at custom-anything dot com

p.s. this is actually a part of a much larger project that I'm working on, but this is ready now and the rest isn't :)

ajfmrf
04-28-2012, 08:10 PM
I am not quite sure what you are asking for in regards of comments.

It sounds to me that what you are describing could save time and "work" by the server as a page(s) are requested.

My thoughts are what exactly would be the results for the average web page?

faster loading time?

keyboard
04-29-2012, 12:50 AM
Also, is it worth it?
How many different resources do you need before this actually makes a noteable change?
Looks like an interesting development, I'll defineatly have to try it...

traq
04-29-2012, 01:11 AM
hi Bud,

regarding "comments":

I'm looking for broad feedback. It would be great to have a variety of people try using this, and let me know what they liked, what problems they encountered --anything, from start to finish.

-----------------------------------

some context to the issue is here (http://stackoverflow.com/questions/5987031/http-request-cost-vs-page-size-cost#answer-5987103).

Basically, if you have a lot of resources attached to a page, your browser needs to request each of them separately, which adds more time to the process. A typical solution is to combine all of a site's resources (all CSS, all javascript) into single files, so only one file needs to be requested. The disadvantage with this approach is that a particular page probably doesn't need all of them.

Two main objectives for this script:

1. Combine resources into fewer HTTP requests, while minimizing total file size by excluding unneeded items.

2. More importantly, provide a CMS with an easy way to dynamically specify which resources are needed in any particular instance.

For example, the framework that I'm developing alongside this script has a method called addResource() that the system (or add-ons) can use to specify a resource that they need, which would be added to the request.

Site-wide resources would still go in "global.css" or "global.js" files, but page-specific resources would be written (and then cached) as needed, automatically.

@keyboard:

You're right, if you only have a few resources for a page, you could easily do what this script does on your own.

As a tool for a CMS, where content is generated on-the-fly depending on the request, I'm hoping this would work well to help manage everything.

I've used earlier versions of this on several projects in the past, and I'm happy with how it helps keep things straight: no missing, extra, or duplicate resources.
(Actually, I should add a check in this script to prevent reading the same resource twice...)

ajfmrf
04-29-2012, 07:08 PM
Wow,this is so far over my head that I don't know what to say.

I don't understand anything you said in the post before this on nor do I have any idea what that link took me to.

But I do have a web page I have been working on that is huge in size(for me anyway.)It is 49.5kb as of now and may grow even more.

It uses rss feeds,javascript and css-some of which are good sized too.

If I can be of help some how email me and I will see what I can do.

traq
04-29-2012, 07:59 PM
...maybe I'll set up a demo page. :D

thanks, Bud!