Would Bigpipe be applicable in this case?

Asked

Viewed 130 times

2

I was reading about how big web-sites work and I got to know Bigpipe.


What is Bigpipe (kids)

Bigpipe was a feature created by facebook, what it does is make page loading time faster, page content is divided into parts called "Pagelets" and can load some of them simultaneously or item-by-item.


Well, I’m working on a project a little big and I thought about putting this technique into practice, but I doubted.

My pages are technically loaded only once, that is, the main js css are loaded into the index. On this page there is a view, is in this view that pages are loaded in through the function load() jQuery and so my site works, the pages are pulled and loaded there. Taking into account that these pages do not contain files, only compressed html.

Use internal and also external cache system for files that do not change frequently as images etc..

My question, would it be useful to use Bigpipe in this case, or would not make a difference in performance?

  • Please avoid long discussions in the comments; your talk was moved to the chat

  • I do not understand why the question was closed. Unless I am mistaken, the answer seems obvious to me. A bigpipe technique mainly serves to decrease the total time in which the page can be viewed by the user, making better use of the parallel and asynchronous loading of page snippets and features like CSS and JS. If the system loads these resources only once and seems not to be divided into logical and independent sections, Bigpipe brings little or no gain.

  • Good evening @utluiz The question was closed by the fact (my point of view) that "wear or not" is something that has variation from server to server and number of clients and what potential the project intends to achieve, so I believe that the author understands the technique, but there is no way to answer if it would make a difference in his project, because the question was this "or make no difference in performance?", maybe we had to have closed as cannot be reproduced, but in my opinion it was not well by ae. However we can reopen if find interesting. Until tomorrow.

  • @Guilhermenascimento I agree that the question was very specific for the AP project. But I see it as "can the X technique be used in the Y scenario?", which would be perfectly responsive even in theory. Perhaps if the AP moves the question a little, especially at the end, the thing becomes clearer.

  • @user3163662, I suggest you slightly change the last paragraph of your question to something like: Would it be applicable to use Bigpipe in this scenario? It could contribute to some difference in performance?. I believe that way the question becomes less opinionated.

1 answer

2


TL;DR

Possibly the gain will be small, if there is any, because Bigpipe does not seem a suitable technique for the scenario proposed in the question.

Performance is a box of surprises

Not it is possible to state whether Bigpipe will positively or even negatively affect the performance of an application without effectively implementing and collecting before and after data.

In addition, any optimization should be done within a relevant context. Users present different habits and usage needs of a system. Bigpipe helps parallelize the display of a composite page, but is the biggest user problem not one of the queries that takes a long time to return? In such a case, you can invest all the resources in optimization techniques and the user will still be dissatisfied because the information that interests him continues to take a long time to appear.

Only start thinking about complex optimization techniques if actually the performance is a problem and a diagnosis has been made so that you have confidence that the appropriate technique has been selected. Never apply optimization techniques without it, as the cost to implement and maintain them is high and will be money thrown down the drain.

Why not use Bigpipe

By system description, there are not several sections in the system that are displayed at the same time.

A parallel implementation that only displays a single page at a time will only generate system overload, i.e., unnecessary processing.

Alternatives

For a system that loads all resources only once, the concern is on the first access the user makes to the homepage.

Well, the first step is to put everything static, such as images, styles and scripts, minified in a CDN to ensure the shortest possible time to download resources.

Once done, measure load time without cache usage. If not satisfactory, you can use some simple techniques:

Flush header Early

Some Engines of templates assemble the whole page and then send it to the user. Others do buferization. The problem is that in this case the browser will have to wait the processing on the server until it receives the header and can start downloading the declared styles and scripts.

Change this so that one occurs flush that send the entire tag <head> in the first milliseconds of the request. That way, while the server thinks, the browser is downloading the resources.

For this to work even better, declare all tags <script> in the header with the attribute async for the browser does not lock the rest of the page while loading the scripts.

Pre-loading in the background

A simple way to give a sense of fluidity is to pre-load the features of the screens on which the user will access while he is doing something.

A very simple example would be to pre-load the static system resources asynchronously while the user is logging in or is looking at the home page.

It’s almost a cheat, but that way when the user accesses a system screen the browser will have the resources cached.

Beware of caching

Systems that need scaling should try as hard as possible to store state. Create services stateless allow distributing the system, avoid delays with code cache (not initialized cache), avoid Stale data (old data being used incorrectly), and so on.

Improperly made caches are a tremendous headache later, a real source of problems, limitations and bugs.

Distributed cache is costly for a small system, after all synchronizing information also costs time, and is complicated for a large system.

A cache is like putting a mutant state on the system and you will always have to worry about whether that state is properly updated and how the update will be done. Often it’s not worth it.

Performance depends on implementation

Regardless of the optimization technique that applies, your implementation will always speak loudly.

A poorly implemented Bigpipe can increase the total time until the event ready for user. A poorly implemented cache can be worse than a database query. An SQL code that does table scan can be worse a REST call to an external service.

These examples are reasons why the major concern is always with a good system implementation and less with specific performance improvement techniques.

  • 1

    Great response, mainly by "that is, unnecessary processing." +1

  • 1

    I had avoided altering the question by finding something from research that answered my questions, but you added more things, thank you! Finally I will change some structures of my project to implement some simple things and make everything harmonic.

  • 1

    I think it’s nice to point out that performance tests should be performed. I did, a brief, with Bigpipe the page loaded the DOM at 385ms and the page itself at 1.30s. Without it the DOM loaded at 754ms and the page itself at 915ms. The difference is noticeable.. But the question remains in the air, it is really necessary ?

  • 1

    There are other nice figures, which show me at least superficially that Bigpipe brings some improvements that on a large scale would be significant, but brings negative points. In my case clear..

  • 1

    @user3163662 Interesting points. Just note that you don’t necessarily need to use Bigpipe to load the page first. Bigpipe is a specific case involving a composition of small techniques for simultaneous display of multiple parts on a page. The important thing is to always give the visual response to the user as early as possible and, depending on the case, this can be done simply. For example, remove unnecessary scripts and make the necessary ones run after the page appears. Batch static Resources and immediate header flush.

  • 1

    @user3163662 Sorry it rains on the wet, but it gets just to emphasize. You seem to know what you’re doing.

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.