25.01.2015 Views

Using Node.js with Caché - InterSystems Documentation

Using Node.js with Caché - InterSystems Documentation

Using Node.js with Caché - InterSystems Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

1<br />

Introduction<br />

This document describes cache.node, an add-on module for the <strong>Node</strong>.<strong>js</strong> environment that implements high performance<br />

access to data held in <strong>Caché</strong>.<br />

<strong>Node</strong>.<strong>js</strong> provides a means through which high performance and highly scalable network infrastructure can be easily created.<br />

It is different from conventional thread based networking software (such as web servers) because it provides a non-blocking<br />

event based architecture.<br />

Most modern web servers are implemented using a hybrid multi-process/multithreaded server architecture where a thread<br />

is dedicated to serving each request. All resources associated <strong>with</strong> that thread remain allocated until the request is satisfied<br />

and a response dispatched to the client. In the <strong>Node</strong>.<strong>js</strong> architecture, a single process is used per instance (of node) and<br />

threads are only used as a means through which operations and system calls that would otherwise block can be called<br />

asynchronously <strong>with</strong> respect to the primary thread of execution. Everything happens asynchronously, and a primary design<br />

feature is that no function should block, but rather accept a callback function that <strong>Node</strong>.<strong>js</strong> will use to notify the initiating<br />

program that the operation has completed.<br />

A consequence of the event based server architecture is that system resources (such as heap memory) are never tied-up<br />

while waiting for some other operation to complete. Because of this, network programs developed using <strong>Node</strong>.<strong>js</strong> occupy<br />

a very small footprint in terms of system resource and memory usage and a high level of scalability.<br />

The cache.node module allows <strong>Caché</strong> to be leveraged as a high performance persistence storage engine that perfectly<br />

complements the high performance <strong>Node</strong>.<strong>js</strong> environment. <strong>Caché</strong> multidimensional storage provides a very fast, flexible<br />

storage model that can be used to implement a wide variety of data structures. The <strong>Caché</strong> cache.node module allows direct<br />

access to globals, the basis of the multidimensional storage model (see <strong>Using</strong> <strong>Caché</strong> Globals for a formal description).<br />

<strong>Caché</strong> can be regarded as a NoSQL database providing B-Tree based storage but <strong>with</strong> one important difference. Whereas<br />

most B-Tree databases implement one-dimensional key/value storage, <strong>Caché</strong> provides a multi-dimensional multiple key/value<br />

storage model. This provides the basis for a highly structured NoSQL data repository. In <strong>Caché</strong> terminology, each entry is<br />

known as a "global node".<br />

Examples:<br />

One-dimensional Global Storage:<br />

MyGlobal(“key1”)=”value1”<br />

MyGlobal(“key2”)=”value2”<br />

MyGlobal(“key3”)=”value3”<br />

Multi-dimensional Global Storage:<br />

<strong>Using</strong> <strong>Node</strong>.<strong>js</strong> <strong>with</strong> <strong>Caché</strong> 3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!