> The DelegateSessionVar will probably exhibit the same lifetime as a RequestVar so that it doesn't constantly have to go fetch the value
Typo ordo you mean DelegateRequestVar ?
However, I did have a somewhat similar idea of a reverse proxy with knowledge of the backend servers, but applied to REST APIs to we can have secure rest apis with random parameter names/URI, so your rest apis can come and go as they please and it is just this one proxy that keeps the map of random strings => rest api end points, but I don't want to hijack your email with it :)
Diego
Sent from my cell
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
The browser hits the master web app, does the master make an http request to one of the delegates and returns whatever html the delegate gave?
Does the master app need any knowledge of how the delegates respond to certain requests?Because if it does, then I cannot just deploy one of the delegates with new code, I need to also deploy a new master, and if one delegate needs code from another delegate, then I need to keep track of the graph of dependencies.
So which lift app talks to the database, the master or the delegates?
Typo ordo you mean DelegateRequestVar ?
Regarding the presentation of templates, I don’t entirely agree. Sure, you can rig it such that things are consistent by practice. But I do think that this approach might encourage and enable sharing of that common content without duplication or having to store it in a common library that you then have to version bump in every module every time it changes. Or, worse, result in developers sticking such content in a common folder that all of the components are just expected to have access to – which breaks (or at least cripples) the actual modularity I’m seeking.
In my ideal world, I want to be able to have delegates move around within an EC2 VPC and as be able to come up and down at will. As long as their Elastic IP follows them, it would “just work” because the entire contract for common resources is through an API and changes to those common resources wouldn’t inherently require a new release of the delegate.
Now, to the problems that you mentioned with regard to development and operations: These are all things that are true of the microservice model in general. As with microservices, you must have well defined contracts or making any changes sucks (I would argue sharing database schemas directly would be a no-no for example). As with microservices, you have to figure out how to arrange and allocate resources to more parts on a server. As with microservices, local development can become more problematic. In spite of those issues, this is a model that engineers sometimes find beneficial.
I’m merely seeking to give people a “Lifty” way to do that in a large web application when they decide they need it. Something that provides a secure, uniform way for state/resource sharing between a delegate and a master. It’s certainly not something for the faint of heart. I’ll probably never touch it on my side projects. But I do think this provides a big enough benefit to the people that need it (of which my employer is one) that it’s worth having in the Framework.Phew! Now on to your questions!The browser hits the master web app, does the master make an http request to one of the delegates and returns whatever html the delegate gave?Yes.Does the master app need any knowledge of how the delegates respond to certain requests?Because if it does, then I cannot just deploy one of the delegates with new code, I need to also deploy a new master, and if one delegate needs code from another delegate, then I need to keep track of the graph of dependencies.No, the master is a dumb proxy in this arrangement. It doesn’t care how the delegate responds except in the case the delegate isn’t there, in which case the master would return a 503. And the user code can already customize how that would appear to the end-user through an existing LiftRule.
So which lift app talks to the database, the master or the delegates?They both can. As with microservices, the engineering team has to define contracts that make sense for what they’re building but cross-polination should be kept to a minimum. So, the delegates might be required to have some concept of a User, right? And the engineering team has to figure out how to handle the fact that the specification for a User could change and how that might affect things. But if you’re building something and find that you’re sharing more than one or two model objects directly across modules then I’d argue you either need to abandon using this architecture or rethink your modeling.Typo ordo you mean DelegateRequestVar ?
No, it would be DelegateSessionVar. A DelegateSessionVar should only exist on the delegate application, but should retain its value for a Request. At the beginning of each new request it’s initializer should fetch the current value from the master node.
Are you talking about separate (git|etc) repositories for master, delegate1, delegateN ?
Is this along the lines of what Joe was talking about on another thread? where even the server side binded functions will still work? If so, are you saying the function name => function map stays on the master node?
Not to go too far off topic but this is actually something I want to find out, if all those who use the microservice idea just live with the development pain or if there is a "nice" way to develop them, but again, may be off topic here.
Ok, so if in this case the master is a dumb proxy, in which case is the master "smart", I think I'm really missing the point of what you are trying to say.
Ah ok, and then the delegate has to somehow tell the master of the delegate changed the value of the DelegateSessionVar ?Also, DelegateSessionVar are individual per delegate, right? or can I expect to set a DelegateSessionVar on server! and read it on server2 ?
Are you talking about separate (git|etc) repositories for master, delegate1, delegateN ?For the specific scenario I’m thinking about? Yes. But at the very least separate sbt projects for each.
Is this along the lines of what Joe was talking about on another thread? where even the server side binded functions will still work? If so, are you saying the function name => function map stays on the master node?No, as stated below, the master is “dumb.” It has no knowledge of function information from any other modules. Likewise, delegates have no knowledge of function numbers from a master. In the event a node goes down and comes back up session state would be still be lost as it is today.
Not to go too far off topic but this is actually something I want to find out, if all those who use the microservice idea just live with the development pain or if there is a "nice" way to develop them, but again, may be off topic here.I haven’t dug enough into that world to know yet, to be honest.Ok, so if in this case the master is a dumb proxy, in which case is the master "smart", I think I'm really missing the point of what you are trying to say.The point is that we’re providing a way to share session state with the delegates. The master is a dumb proxy, but its sitemap will drive which delegate gets accessed for what URL patterns. It could also, foreseeably, handle access control into the module itself using its LocParams. I haven’t played too much with that yet, tbh.
A “dumb proxy” isn’t investigating the content it’s relaying. A “smart proxy” would. The master doesn’t care what the delegate sends back. It doesn’t investigate it. It doesn’t cache it. It just forwards the response. This architecture is certainly smart in other ways. Not that I’m biased. ;)
Ah ok, and then the delegate has to somehow tell the master of the delegate changed the value of the DelegateSessionVar ?Also, DelegateSessionVar are individual per delegate, right? or can I expect to set a DelegateSessionVar on server! and read it on server2 ?Ah, sorry, this maybe wasn’t clear.DelegateSessionVars are read only. The only way they obtain a value is by reading it from the master. That’s an important detail. So this is for storing things like “the current user’s ID” right? The master would handle authentication, store the value in a MasterSessionVar, and then all DelegateSessionVars in the delegate apps that have the same name would have the same value.Whatever you store in one of these guys would have to be JSON serializable so it can be sent over the wire.
If Google were to adopt this architecture, would it be along the lines of, Google Search is one delegate and Gmail is another ? or more like, Displaying emails and sending emails in Gmail is one delegate, and the contact part of Gmail is another delegate?
Can't nginx do this, where url patterns sends traffic to certain server? (Minus the LocParam)
Ah, I missed the read-only partOK, let's see if I'm getting closer to what you are proposing.
* The master node would act like reverse proxy in the case where based on some url pattern (SiteMap or something else), it will know which delegate to query, to satisfy the http request from the user's browser.* The master also acts like a datastore, where you can store things like the current userID, maybe locale, and it would also keep some html templatesIs this more or less accurate?
As i understood it, the main idea is about delegating whole pages to other lift apps. They are identified by the URL and mapped in the Sitemap, right?
Wouldn't it be more elegant to only delegate parts of the page which rely on the specific delegate? My idea would be to delegate only snippets calls:
- master parses template
- there is a snippet not found in the master, so it will be delegated (here is some kind of mapping needed)
- delegation could be done asynchronous, the delegate only needs the html node the snippet is inside.
- the master could then replace the snippet call with the answer from the delegate