One of the best ways to explain how NetKernel works is to
compare a NetKernel Accessor with a browser operating in the World
Wide Web.
Browser ABCs ...
The service provided by a web browser is the (usually visual)
presentation of a resource located in the World Wide Web. We use
web browsers so often we usually don't take time to ponder how they
perform their service. It is instructive however, as a browser
functions in basically the same way as an accessor does in
NetKernel.
Fundamentally, a browser accepts a request for a URL, retrieves
that resource, performs a page-flow layout and presents the visual
representation to a user. As we examine these steps we'll also see
reasons why the World Wide Web is flexible and scalable.
First, consider the nature of a resource. When we request a
resource identified by a URL such as "http://www.google.com" we are
specifying the address for a resource within the World Wide Web
address space. Resources are used to model abstract information.
For example, the resource "http://www.1060research.com" is an
abstract notion - the "home page" for the 1060 Research web site.
It may seem strange to think about this, but the home page doesn't
actually exist until it is requested. The act of requesting
"http://www.1060research.com" causes the endpoint responsible for
it to create and return a physical representation. All
representations are immutable - they cannot be changed, they can
only expire and become invalid. Architecturally, immutability is
wonderful for scaling. In the World Wide Web immutable
representations can be stored in various locations to speed up
processing such as in a browser or a proxy server or cache. As long
as the representation has not expired, it can be provided by any of
these caches, saving a trip to and work by the endpoint.
Second, consider what a browser does when it receives an HTML
encoded resource representation. The browser interprets the HTML
codes and if it finds resource references (such as for CSS, image,
sound or other resources), it must issue sub-requests for them
before it can perform its service. Once it has gathered all the
referenced resource representations it can perform the page-flow
layout work and build a visual representation. (Notice that a
browser is free to issue the sub-requests asynchronously thereby
creating parallel processing requests)
Third, consider the mapping of the logical address to an
endpoint. For each request, the browser relies on the Domain Name
Service (DNS) to map a logical address to an endpoint. While DNS is
heavily cached and uses reasonably long expiry times there is no
fundamental reason why an IP address couldn't be different for each
request. In fact, IP round-robin assignment is a technique used to
distributed requests across several endpoint IP addresses. For very
large sites an IP load balancer is used to map a single IP address
to one or potentially thousands of servers. In these horizontally
scaled designs there is no notion of threads - all that a user and
browser sees are requests.
A browser working with the World Wide Web is an amazingly
flexible system. All addresses are logical and are bound to an
endpoint for each request. Because of this indirection, web sites
can appear and disappear, expand or contract at any time. Web
servers can be upgraded or changed to different technologies and
there is no impact on browsers - there is no physical coupling.
Processing can occur in parallel without requiring knowledge of
threads and immutable representations can be cached increasing the
responsiveness of the whole system.
These are great properties! What if we could use this approach
to develop software itself? Would we see the same properties from
the web evident in software?
Turns out, we can ... and we do ...
NetKernel ABCs ...
In NetKernel all information is modeled as resources and
resources are identified by URI addresses.
When a resource is requested, the address is resolved to an
endpoint known as an Accessor. Like the browser, an accessor
returns a representation of a resource. Also like a browser, an
accessor may interpret codes and request additional resources.
Unlike a browser, an accessor can return any form of
representation. You can think of an accessor in NetKernel as a
browser without the visual presentation surface.
Again, let's consider resources. In NetKernel resources
represent abstract information such as "the list of customers" or
"currently enrolled students". These resources are identified by
URI addresses such as "ffcpl:/resources/customers" and
"ffcpl:/enrolled_students". When a resource is requested, an
endpoint returns the current state of that resource as a physical,
immutable resource representation. A resource may be fundamental
and atomic or it may be composed of other resources. For example,
an application that assigns students to courses would need to
compose a presentation page from the "list of courses" resource and
the "list of students" resource.
Processing Steps
When an endpoint accessor receives a request, it examines the
request to determine the context and specifics of the request. It
can examine the requested URI and the names and URI addresses of
each parameter. The following table illustrates the processing
steps taken by a browser and a NetKernel accessor upon receiving a
request.
|
Browser |
NetKernel |
| Examine Request |
Browser parses the URL entered by the user. |
Accessor examines URI and parameters. |
| Determine if sub-requests are required. |
Browser always makes at least one sub-request. |
Most accessors make sub-requests. |
| Issue sub-request(s) |
- Browser parses URL to obtain domain name.
- Queries DNS with domain name.
-
- Send DNS query with domain name.
- DNS resolves domain name to IP address.
- DNS returns IP address for endpoint to browser.
- Browser issues sub-request to endpoint.
- Endpoint returns representation to browser.
|
- Sub-request created with URI address and parameters.
- Sub-request issued to microkernel in current address
space.
-
- Microkernel resolves to endpoint.
- Microkernel issues request to endpoint.
- Endpoint returns representation.
- Microkernel returns representation to Accessor.
|
| Create representation |
Browser performs a page-flow layout using all returned resource
representations. |
Accessor performs its service and creates a
representation. |
| Return representation |
Browser displays a visual representation of the resource. |
Accessor creates a response referencing a representation and
returns it to microkernel. |
The only significant difference between a browser and an
accessor in NetKernel is the way endpoint resolution is
accomplished. A browser uses DNS to locate an endpoint in a single,
global address space while an accessor relies on NetKernel's
microkernel to resolve an address in a set of related address
spaces.
It is important to note what is not occurring - the
NetKernel accessor is not referencing physically linked
objects, data or code. If it requires additional information it
issues a sub-request for a logically identified resources
back into the logical address space. This is significant and
extremely important.
The following code illustrates a BeanShell script that requests
the students and course information:
void main() {
// Request students and courses resources
repStudents = context.source("ffcpl:/enrolled_students");
repCourses = context.source("ffcpl:/2008/spring/courses");
...
}
Because information is modeled as resources and resource
addresses are bound to an endpoint only at the moment of each
request, NetKernel applications take on the properties of the World
Wide Web:
- Flexibility - Resource endpoints can be mapped to
different endpoint implementation for each request. This means that
operational systems can be modified, upgraded and down graded at
any time while handling requests.
- Scaling - Requests know nothing of threads. The
microkernel is free to asynchronously schedule requests from its
carefully managed pool of threads onto any available CPU core. As
cores are added, performance increasing almost linearly.
- Generational growth - clients and endpoints can evolve
independently of each other. Because they are logically coupled, a
change in either does not require code recompilation of the entire
system.
These and other properties accrue to NetKernel systems. The idea
of building information systems at the logical level of information
instead of the physical level of objects and data has been
validated by the World Wide Web as well as the numerous
applications built and running on NetKernel.