Thanks once again, Peter.
Apologies for my string of questions but I need to be sure I fully understand the implications of design decisions and methodologies on performance. NetKernel is the first technology in a long time that has really excited me as a breath of fresh air - I think the last one was Java itself:)
The scenario I'm designing for is where the fragments making up the user-requested (aggregate) document are themselves personalised to the user and are frequently requested.
An off-the-top-of-my-head example:
A 'social networking' site portal page after the subscriber has authenticated. The user can choose which components appear on their page (think Portlets) and where they are positioned (think iGoolge / Google Web Toolkit).
Now, with a fully capable browser with Javascript enabled the updating of the portlets is delegated to the client Javascript libraries, that in turn request individual portlet content from the server (as XML or JSON).
In other instances where Javascript is disabled or unavailable then the server will render each entire portal view update and return it as XHTML.
Within the portal view let's assume there are ten portlets.
Five of them return generic site content that is invariant across users. To achieve optimal netkernel caching for these the requests are keyed on the URI, with a golden thread that invalidates the cached representations when underlying data changes.
The other five portlets return information that is user-specific. As an example I can think of an account status portlet that reports statistics such as number of new messages in Inbox, storage space used, number of pending link requests, etc. This is frequently re-requested by the client.
For the status portlet the accessor that provides the resource has to make potentially expensive calls to a variety of other services on remote hosts as well as local sub-requests, so the aim is to ensure the representation is cached.
To achieve optimum performance the application has to ensure the URI is cacheable.
The web-application can either use a golden thread or a periodic cron job that batch-updates the statistics for all connected users (cron jobs are better for performance as they can be synchronised with jobs on remote servers so updates don't impose ad-hoc load).
The earlier example URI I gave using data: is a very simple one. In practice the session has to be taken into consideration, and possibly some QueryString parameters.
I've looked at session: handling, especially related to HTTP. The
documentation suggests that the session ID is passed-by-value on the URI:
active:dpml+operand@ffcpl:/mypath/myprocess.idoc+session@session1234567890123456 |
and also says
The sessionmapper requires that your HTTPBridge be configured to pass cookies |
As I understand it both of these will prevent the representation being cached, so I'm looking for the best way to achieve caching of the representation whilst still being able to pass sufficient context.
For the session ID I'm thinking the session mapper functionality could be amended to use a data: URI:
active:dpml+operand@ffcpl:/mypath/myprocess.idoc+data@data:text/plain,theClientID+session@data:text/plain,SessionID |
If I'm lucky, the fact that the Session Mapper is receiving the cookie from HTTPBridge and sinking it means that the URI I've proposed immediately above would be sufficient for the endpoint accessor to access keys in the cookie it needs to create those personal representations, and the representation to still benefit from caching.
The representation will be cached whether it is a sub-request of the aggregate portal view accessor or a direct (mapped) request from the client Javascript libraries.
If I'm unlucky there's a lot of work to do reworking the parameter handling!