<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Simulating Place/Transition Nets by a Distributed, Web Based, Stateless Service</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Jan Henrik Röwekamp</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Matthias Feldmann</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Daniel Moldt</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Michael Simon</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>University of Hamburg, Faculty of Mathematics</institution>
          ,
          <addr-line>Informatics and Natural Sciences</addr-line>
          ,
          <institution>Department of Informatics</institution>
        </aff>
      </contrib-group>
      <abstract>
        <p>Executing Petri nets in a distributed manner is, in general, a non-trivial task. To achieve portability of the simulation, as a precondition for scalability, it is desirable to keep the majority of the simulation components stateless. This paper presents a first approach to model distributed Place/Transition nets (P/T nets) using stateless services and only a (stateful) database. The presented theory has been implemented in a web API based service. First tests look promising.</p>
      </abstract>
      <kwd-group>
        <kwd>P/T Nets</kwd>
        <kwd>Distributed Systems</kwd>
        <kwd>Scalability</kwd>
        <kwd>Stateless Architecture</kwd>
        <kwd>Tools</kwd>
        <kwd>Container</kwd>
        <kwd>Docker</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
    </sec>
    <sec id="sec-2">
      <title>Concept</title>
      <p>To cope with the critical parts of a distributed Petri net simulation focus is
put on the net partitioning, firing uniqueness and atomic token consumption. In
regards to data storage transition firings and token consumption are both write
operations. Write operations usually tend to be problematic in a concurrent
environment.</p>
      <p>PNSE’19 – Petri Nets and Software Engineering
Transition Firing and Token Consumption
As actively simulating transitions in a distributed fashion imposes severe
difficulties in regards to the uniqueness of firing and/or self-concurrency, the presented
approach focuses on simulating active tokens. Tokens, however, may also occur
as passive entities. Actively simulated tokens will be referred to as main tokens.
Places are not modeled, but tokens and transitions hold them implicitly.</p>
      <p>The simulation is organized in multiple infinite loops. A node selects a
random token as the main token and loads all tokens of all presets of all attached
transitions into memory. The node then iterates through all transitions and tries
to fire a random active transition. Firing is done by issuing a transaction to the
underlying data storage, that assures uniqueness.</p>
      <p>If conflicts occur (two or more nodes handle the same token), the transaction
will succeed, that is committed into the database first.</p>
    </sec>
    <sec id="sec-3">
      <title>The Simulator Core and Technical Aspects</title>
      <p>The simulator consists of an evaluation unit layer and a database service. The
database service holds the current state of the net, while the evaluation layer
only temporarily copies data, that is required to compute transition firings. As
the evaluation layer is stateless and only communicates to the database, it is
easily scalable. The database layer is harder to scale, but several well-engineered
solutions exist and can be utilized.</p>
      <p>The evaluation layer was implemented using Java Spring, with later
application to colored nets and reference nets in mind, where transition firings and
binding searches become more advanced in the order of magnitudes.</p>
      <p>As scalability is one of the proposed main features, the simulator is designed
to be used with container and PaaS solutions in mind, especially Docker and
Kubernetes. Kubernetes offers excellent means to keep an application robust
and scale it up to several replicas. Automatic scaling solutions (based on CPU
load) also exist.</p>
      <p>Next things to address are the incorporation of existing tools and formats
(like PNML) and the evaluation of graph databases (like Neo4j), as well as the
transition to higher level Petri net formalisms.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Chiola</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ferscha</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Distributed simulation of Petri nets</article-title>
          .
          <source>IEEE Parallel Distrib. Technol</source>
          .
          <volume>1</volume>
          (
          <issue>3</issue>
          ),
          <fpage>33</fpage>
          -
          <lpage>50</lpage>
          (
          <year>Aug 1993</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Röwekamp</surname>
            ,
            <given-names>J.H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Moldt</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Feldmann</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Investigation of containerizing distributed Petri net simulations</article-title>
          .
          <source>In: Applications and Theory of Petri Nets and Concurrency</source>
          . pp.
          <fpage>133</fpage>
          -
          <lpage>142</lpage>
          (
          <year>2018</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Simon</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Moldt</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          :
          <article-title>Extending Renew's algorithms for distributed simulation</article-title>
          . In: Cabac,
          <string-name>
            <given-names>L.</given-names>
            ,
            <surname>Kristensen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.M.</given-names>
            ,
            <surname>Rölke</surname>
          </string-name>
          , H. (eds.)
          <source>PNSE'16. CEUR Workshop Proceedings</source>
          , vol.
          <volume>1591</volume>
          , pp.
          <fpage>173</fpage>
          -
          <lpage>192</lpage>
          . CEUR-WS.org (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>