193 |
arguments |
arguments |
194 |
|
|
195 |
Custom messages for Tapestry |
Custom messages for Tapestry |
196 |
----------------------- |
---------------------------- |
197 |
|
|
198 |
Again, According to the `Tapestry programmer's guide`_: |
Again, According to the `Tapestry programmer's guide`_: |
199 |
|
|
211 |
|
|
212 |
|
|
213 |
An event handler class |
An event handler class |
214 |
------------------ |
---------------------- |
215 |
|
|
216 |
1. Write an event handler class which extends SEDA's existing stages, e.g., |
1. Write an event handler class which extends SEDA's existing stages, e.g., |
217 |
|
|
282 |
Here, we propose a simple StormTapestryManager pseudo code. This is an event |
Here, we propose a simple StormTapestryManager pseudo code. This is an event |
283 |
handler class for Tapestry services. In addition to basic event handling |
handler class for Tapestry services. In addition to basic event handling |
284 |
functionality, this class supports Storm block query and insert operations |
functionality, this class supports Storm block query and insert operations |
285 |
in a Tapestry overlay. |
in a Tapestry overlay. :: |
286 |
|
|
287 |
class StormTapestryManager implements EventHandlerIF { |
class StormTapestryManager implements EventHandlerIF { |
288 |
|
|
289 |
// Dispatcher which dispatches all items |
// Dispatcher which dispatches all items |
290 |
// to a target peer. |
// to a target peer. |
291 |
// (Mandatory: Sandstorm requires this) |
// (Mandatory: Sandstorm requires this) |
292 |
method dispatch (QueueElementIF item) { |
method dispatch (QueueElementIF item) { |
293 |
//try do dispatch an item |
// try do dispatch an item |
294 |
try { |
try { |
295 |
classifier.dispatch(item); |
classifier.dispatch(item); |
296 |
} catch (expection) { |
} catch (expection) { |
480 |
========== |
========== |
481 |
|
|
482 |
Sandstorm configuration files for Storm |
Sandstorm configuration files for Storm |
483 |
-------------------------------------- |
--------------------------------------- |
484 |
|
|
485 |
According to the `Tapestry programmer's guide`_, we have to have |
According to the `Tapestry programmer's guide`_, we have to have |
486 |
three different config files for a Storm peer: |
three different config files for a Storm peer: |
504 |
|
|
505 |
For more information how a Tapestry network is bootstrapped and stabilized, please |
For more information how a Tapestry network is bootstrapped and stabilized, please |
506 |
see the `Tapestry programmer's guide`_. Here's an example config file for a |
see the `Tapestry programmer's guide`_. Here's an example config file for a |
507 |
dynamic Storm peer as the config file includes the DTClient stage: |
dynamic Storm peer as the config file includes the DTClient stage. :: |
|
|
|
|
- - - |
|
508 |
|
|
509 |
# Example Sandstorm configuration file for Storm/Tapestry. |
# Example Sandstorm configuration file for Storm/Tapestry. |
510 |
# |
# |
511 |
# !!! Please notice that the documentation of this file is based |
# !!! Please notice that the documentation of this file is based |
512 |
# on a config file distributed within the Tapestry/SEDA 2.0 release. Some |
# on a config file distributed within the Tapestry/SEDA 2.0 release. Some |
513 |
# parts of this config file are edited to provide better idea which parts |
# parts of this config file are edited to provide better idea which parts |
514 |
# 'Storm specific', mandatory/optional &c !!! |
# 'Storm specific', mandatory/optional &c !!! |
515 |
# |
# |
516 |
# The '#' starts a comment which extends to the end of the line |
# The '#' starts a comment which extends to the end of the line |
517 |
# This file uses an XML-like format consisting of nested sections. |
# This file uses an XML-like format consisting of nested sections. |
518 |
# |
# |
519 |
# Most of the sections of this file are optional. The complete set of |
# Most of the sections of this file are optional. The complete set of |
520 |
# options is given here just to document their use, and leaving options |
# options is given here just to document their use, and leaving options |
521 |
# unspecified causes them to use their default values. In general it is |
# unspecified causes them to use their default values. In general it is |
522 |
# a good idea to just use the defaults. |
# a good idea to just use the defaults. |
523 |
|
|
524 |
# The outermost section in the file must be called 'sandstorm'. |
# The outermost section in the file must be called 'sandstorm'. |
525 |
<sandstorm> |
<sandstorm> |
526 |
|
|
527 |
# Global options |
# Global options |
528 |
<global> |
<global> |
529 |
|
|
530 |
# The default thread manager for stages. |
# The default thread manager for stages. |
531 |
# Allowable values are 'TPSTM' (thread-per-stage) and 'TPPTM' |
# Allowable values are 'TPSTM' (thread-per-stage) and 'TPPTM' |
532 |
# (thread-per-CPU). |
# (thread-per-CPU). |
533 |
defaultThreadManager TPSTM |
defaultThreadManager TPSTM |
534 |
|
|
535 |
# Options for TPSTM thread manager |
# Options for TPSTM thread manager |
536 |
<TPSTM> |
<TPSTM> |
537 |
# Enable the thread governor. This resizes the thread pool for each |
# Enable the thread governor. This resizes the thread pool for each |
538 |
# stage when the stage's incoming event queue reaches its threshold. |
# stage when the stage's incoming event queue reaches its threshold. |
539 |
governor false |
governor false |
540 |
# The sampling delay (in milliseconds) for the thread governor. |
# The sampling delay (in milliseconds) for the thread governor. |
541 |
governorDelay 2000 |
governorDelay 2000 |
542 |
# The maximum number of threads allocated to each thread pool |
# The maximum number of threads allocated to each thread pool |
543 |
governorMaxThreads 10 |
governorMaxThreads 10 |
544 |
</TPSTM> |
</TPSTM> |
545 |
|
|
546 |
# Options for TPPTM thread manager |
# Options for TPPTM thread manager |
547 |
<TPPTM> |
<TPPTM> |
548 |
# The number of CPUs in the system. Eventually this will be |
# The number of CPUs in the system. Eventually this will be |
549 |
# determined automatically. |
# determined automatically. |
550 |
numCpus 1 |
numCpus 1 |
551 |
# The maximum number of threads to allocate. |
# The maximum number of threads to allocate. |
552 |
# In general this value should be equal to numCpus. |
# In general this value should be equal to numCpus. |
553 |
maxThreads 1 |
maxThreads 1 |
554 |
</TPPTM> |
</TPPTM> |
555 |
|
|
556 |
# The Sandstorm profiler is extremely valuable for understanding the |
# The Sandstorm profiler is extremely valuable for understanding the |
557 |
# performance of applications, and for identifiying bottlenecks |
# performance of applications, and for identifiying bottlenecks |
558 |
<profile> |
<profile> |
559 |
# specify whether the Sandstorm system profiler should be enabled. |
# specify whether the Sandstorm system profiler should be enabled. |
560 |
enable false |
enable false |
561 |
|
|
562 |
# specify the samplying delay(in milliseconds) for the profiler. |
# specify the samplying delay(in milliseconds) for the profiler. |
563 |
# Default is 1000 ms. |
# Default is 1000 ms. |
564 |
delay 1000 |
delay 1000 |
565 |
|
|
566 |
# specify the filename that the profile will be written to. |
# specify the filename that the profile will be written to. |
567 |
# default is ./sandstorm-profile.txt |
# default is ./sandstorm-profile.txt |
568 |
filename /tmp/sandstorm-profile.txt |
filename /tmp/sandstorm-profile.txt |
569 |
|
|
570 |
# specify the graphfilename that the graph profile will be written to. |
# specify the graphfilename that the graph profile will be written to. |
571 |
# default is ./sandstorm-graph.txt |
# default is ./sandstorm-graph.txt |
572 |
graphfilename /tmp/sandstorm-graph.txt |
graphfilename /tmp/sandstorm-graph.txt |
573 |
|
|
574 |
# specify whether the profile should generate a graph of stage |
# specify whether the profile should generate a graph of stage |
575 |
# connectivity during runtime. Default is false. |
# connectivity during runtime. Default is false. |
576 |
graph false |
graph false |
577 |
|
|
578 |
# specify whether the outgoing queue length for sockets should be |
# specify whether the outgoing queue length for sockets should be |
579 |
# included in the profile. Default value is false. |
# included in the profile. Default value is false. |
580 |
sockets false |
sockets false |
581 |
|
|
582 |
</profile> |
</profile> |
583 |
|
|
584 |
<initargs> |
<initargs> |
585 |
# Global parameters are defined here, for instance, we could define |
# Global parameters are defined here, for instance, we could define |
586 |
# my_node_id ip-address:port |
# my_node_id ip-address:port |
587 |
</initargs> |
</initargs> |
588 |
|
|
589 |
</global> |
</global> |
590 |
|
|
591 |
# Each stage is defined by a <stage> section |
# Each stage is defined by a <stage> section |
592 |
|
|
593 |
<stages> |
<stages> |
594 |
|
|
595 |
# The name of the stage as registered with the system. Mandatory. |
# The name of the stage as registered with the system. Mandatory. |
596 |
<Network> |
<Network> |
597 |
|
|
598 |
# The fully-qualified classname of the stage's event handler. Mandatory. |
# The fully-qualified classname of the stage's event handler. Mandatory. |
599 |
class ostore.network.Network |
class ostore.network.Network |
600 |
|
|
601 |
# The size of the event queue threshold for this stage. Optional. |
# The size of the event queue threshold for this stage. Optional. |
602 |
# The default is -1, which indicates an infinite threshold. |
# The default is -1, which indicates an infinite threshold. |
603 |
queueThreshold 1000 |
queueThreshold 1000 |
604 |
|
|
605 |
# Initial arguments to pass to the event handler's init() method |
# Initial arguments to pass to the event handler's init() method |
606 |
<initargs> |
<initargs> |
607 |
# Some parameters for this stage |
# Some parameters for this stage |
608 |
</initargs> |
</initargs> |
609 |
|
|
610 |
</Network> |
</Network> |
611 |
|
|
612 |
<Router> |
<Router> |
613 |
class ostore.tapestry.impl.Router |
class ostore.tapestry.impl.Router |
614 |
queueThreshold 1000 |
queueThreshold 1000 |
615 |
<initargs> |
<initargs> |
616 |
# Some parameters for this stage |
# Some parameters for this stage |
617 |
dynamic_route dynamic |
dynamic_route dynamic |
618 |
</initargs> |
</initargs> |
619 |
</Router> |
</Router> |
620 |
|
|
621 |
|
# The name of the stage as registered with the system. Mandatory. |
622 |
|
<DTClient> |
623 |
|
# The fully-qualified classname of the stage's event handler. Mandatory. |
624 |
|
class ostore.tapestry.impl.DynamicTClient |
625 |
|
|
626 |
|
# The size of the event queue threshold for this stage. Optional. |
627 |
|
# The default is -1, which indicates an infinite threshold. |
628 |
|
queueThreshold 1000 |
629 |
|
# Initial arguments to pass to the event handler's init() method |
630 |
|
<initargs> |
631 |
|
# An IP address of a gateway peer which bootsraps us into a Tapestry network |
632 |
|
# This is a mandatory for a dynamic Storm peer |
633 |
|
gateway ${GatewayID} |
634 |
|
# This parameter tells Tapestry to threat local routing tables dynamically |
635 |
|
dynamic_route dynamic |
636 |
|
</initargs> |
637 |
|
</DTClient> |
638 |
|
|
639 |
# The name of the stage as registered with the system. Mandatory. |
# This stage is not mandatory |
640 |
<DTClient> |
# Patchwork stage can be used to monitor neighbor links' conditions &c |
641 |
# The fully-qualified classname of the stage's event handler. Mandatory. |
<Patchwork> |
642 |
class ostore.tapestry.impl.DynamicTClient |
class ostore.network.patchwork.Patchwork |
643 |
|
<initargs> |
644 |
# The size of the event queue threshold for this stage. Optional. |
# list here some arguments which we want to define |
645 |
# The default is -1, which indicates an infinite threshold. |
</initargs> |
646 |
queueThreshold 1000 |
</Patchwork> |
647 |
# Initial arguments to pass to the event handler's init() method |
|
648 |
<initargs> |
# The name of the stage as registered with the system. Mandatory. |
649 |
# An IP address of a gateway peer which bootsraps us into a Tapestry network |
<StormTapestry> |
650 |
# This is a mandatory for a dynamic Storm peer |
class org.nongnu.storm.p2p.tapestry.StormTapestryManager |
651 |
gateway ${GatewayID} |
queueThreshold 1000 |
652 |
# This parameter tells Tapestry to threat local routing tables dynamically |
|
653 |
dynamic_route dynamic |
# Initial arguments to pass to the event handler's init() method |
654 |
</initargs> |
<initargs> |
655 |
</DTClient> |
# list here some arguments which we want to define |
656 |
|
</initargs> |
|
# This stage is not mandatory |
|
|
# Patchwork stage can be used to monitor neighbor links' conditions &c |
|
|
<Patchwork> |
|
|
class ostore.network.patchwork.Patchwork |
|
|
<initargs> |
|
|
# list here some arguments which we want to define |
|
|
</initargs> |
|
|
</Patchwork> |
|
|
|
|
|
# The name of the stage as registered with the system. Mandatory. |
|
|
<StormTapestry> |
|
|
class org.nongnu.storm.p2p.tapestry.StormTapestryManager |
|
|
queueThreshold 1000 |
|
|
|
|
|
# Initial arguments to pass to the event handler's init() method |
|
|
<initargs> |
|
|
# list here some arguments which we want to define |
|
|
</initargs> |
|
657 |
|
|
658 |
</StormTapestry> |
</StormTapestry> |
659 |
</stages> |
</stages> |
660 |
|
|
661 |
</sandstorm> # End of the configuration file |
</sandstorm> # End of the configuration file |
662 |
|
|
|
- - - |
|
663 |
|
|
664 |
Also, any parameter's value can be set using a command line arguments. For |
Also, any parameter's value can be set using a command line arguments. For |
665 |
more information about Sandstorm's config files, please refer to the documentation |
more information about Sandstorm's config files, please refer to the documentation |
668 |
Running Storm with Tapestry |
Running Storm with Tapestry |
669 |
--------------------------- |
--------------------------- |
670 |
|
|
671 |
To run Tapestry with Storm, we must use the following syntax: |
To run Tapestry with Storm, we must use the following syntax. |
|
|
|
|
sandstorm <storm-configfile-name> |
|
|
|
|
|
where `sandstorm` is a script distributed within the Sandstorm package and |
|
|
`<storm-configfile-name>` is the Sandstorm configuration file for Storm. |
|
672 |
|
|
673 |
|
sandstorm <storm-configfile-name> |
674 |
|
|
675 |
|
where ``sandstorm`` is a script distributed within the Sandstorm package and |
676 |
|
``<storm-configfile-name>`` is the Sandstorm configuration file for Storm. |
677 |
|
|
678 |
Also, we can use Perl scripts to handle more complex usage scenarios. In the |
Also, we can use Perl scripts to handle more complex usage scenarios. In the |
679 |
Tapestry 2.0 release, Perl scripts are used to create `dynamic' configuration |
Tapestry 2.0 release, Perl scripts are used to create dynamic configuration |
680 |
scripts for regression tests. |
scripts for regression tests. |
681 |
|
|
682 |
Changes |
Changes |
685 |
Eight new classes will be implemented under org.nongnu.storm.p2p.tapestry package |
Eight new classes will be implemented under org.nongnu.storm.p2p.tapestry package |
686 |
into the Storm code base, if this PEG document is accepted. |
into the Storm code base, if this PEG document is accepted. |
687 |
|
|
688 |
.. _`Tapestry programmer's guide`: http://www.cs.berkeley.edu/%7Eravenben/tapestry/html/guide.html |
.. _Tapestry programmer's guide: http://www.cs.berkeley.edu/%7Eravenben/tapestry/html/guide.html |
689 |
.. _Tapestry: http://www.cs.berkeley.edu/~ravenben/publications/pdf/tapestry_jsac.pdf |
.. _Tapestry: http://www.cs.berkeley.edu/~ravenben/publications/pdf/tapestry_jsac.pdf |
690 |
.. _`Tapestry website`: http://www.cs.berkeley.edu/~ravenben/tapestry/ |
.. _Tapestry website: http://www.cs.berkeley.edu/~ravenben/tapestry/ |
691 |
.. _SEDA: http://www.eecs.harvard.edu/~mdw/proj/seda |
.. _SEDA: http://www.eecs.harvard.edu/~mdw/proj/seda |
692 |
.. _`DOLR abstraction`: http://www.cs.berkeley.edu/~ravenben/publications/pdf/apis.pdf |
.. _DOLR abstraction: http://www.cs.berkeley.edu/~ravenben/publications/pdf/apis.pdf |
693 |
.. _DHT: http://www.cs.berkeley.edu/~ravenben/publications/pdf/apis.pdf |
.. _DHT: http://www.cs.berkeley.edu/~ravenben/publications/pdf/apis.pdf |