What is the difference between a few simple subscriptions and one complex?

Is there any practical difference between saving several simple (simple) signatures and saving one complex (many levels)? (e.g. with composition publication)

It seems to me that there should not be any difference, but I wanted to be sure. I prefer sticking to simple subnets, as it seems to make the code clearer in high-modulus projects, but only if it doesn't lead to performance or scalability issues.

So can someone help me?

+6
source share
2 answers

There are two key differences in performing a few simple subscriptions and in terms of storing a complex composite subscription.

1) Exposure / Confidentiality

Composite subscription allows connections / filters on the server side to ensure that you send only the data that the current user has to view. You do not want to disclose your entire database to the client. Keep in mind that even if your user interface does not display data, the user can log into the console and capture all the data that your server publishes.

2) Customer performance

Performing connections / filters on the client can be expensive if you have a large dataset. This, of course, depends on your application. In addition, if the database is constantly updated, and these updates should not be visible to the user; you will constantly need to transfer updates to the client without receiving the benefits of network expenses.

0
source

I think this question cannot give an exact answer without any details specific to your application. However, I think this is an important issue, so I’ll talk about some things to consider.

To be clear, this answer will focus on the relative merits of server and client reactive associations .

decide if you need reactivity

You can create a simple union of several collections without any reactivity in the publisher (see the first example from the article above). Depending on the nature of the problem, you may not really need a reactive compound. Imagine that you join the comments and authors, but your application always has all the possible authors published already. In this case, the main drawback in non-reactive associations (missing child documents after the new parent) will not exist, therefore reactive publication is redundant.

consider security model

As I mentioned in my article about joins , server connections have the advantage of combining all of your data together. Connections require more granular publishers. Consider the security implications of having a publisher like commentsAndAuthors and two common implementations of comments and users . The latter assumes that anyone can request an array of user documents without context.

server connections can be processors and memory

Look closely at the library implementation that you are considering for joining the server side. Some of them use observe , which requires each complete document in the dependency chain to be stored in memory. Others are only implemented on observChanges , which is more efficient, but makes packages a little less flexible in what they can do.

look for reuse observer

One of your goals should be to reuse your observers . In other words, given that you will have a simultaneous subscription S, you will only finish work ~ (SI), where I am the number of identical observers on all clients. Depending on the nature of your subscriptions, you may see greater observer reuse with more detailed subscriptions, but this is very application specific.

be careful with the delay

The big advantage of server-side attachments is that they simultaneously deliver all documents. Compare this with the client, which should wait for each set of parent documents to appear before activating child signatures. An N-tier client connection will have N rounds before the original set of documents is delivered to the client.

output

When deciding which method to use for each of your publications, you need to consider all of this. The reality is that benchmarking a live application on something like kadira is the only way to arrive at a final answer.

0
source

All Articles