<!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>A cloud-based parallel system for locating customers in indoor malls</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Pedro A´ lvarez</string-name>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Noelia Herna´ndez</string-name>
          <email>noelia.hernandez@uah.es</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Javier Fabra</string-name>
          <email>jfabra@unizar.es</email>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Manuel Ocan˜a</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>University of Alcala ́, Computer Engineering Department</institution>
          ,
          <country country="ES">Spain</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>University of Alcala ́, Department of Electronics</institution>
          ,
          <country country="ES">Spain</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>University of Zaragoza</institution>
          ,
          <country country="ES">Spain</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Advances in techniques of locating mobile users have promoted the development of marketing campaigns based on customers' location. WiFi-based location methods have proven their usefulness in tracking and locating customers within a indoor mall. Nevertheless, in some cases the performance of these methods prevents them from being used in real scenarios. In this paper, we have faced the problem of improving the execution time and reducing the cost of one of these WiFi-based location methods. Parallel programming techniques, serviceoriented technologies and the cloud computing paradigm have been combined to solve efficiently these problems. The resulting system has been deployed in the Amazon EC2 environment, evaluating different configuration and deployment options.</p>
      </abstract>
      <kwd-group>
        <kwd>WiFi-based location</kwd>
        <kwd>Parallel algorithms</kwd>
        <kwd>Cloud computing</kwd>
        <kwd>Time and cost analysis</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        The BAI4SOW project [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] provides a software platform to create marketing
campaigns based on three main concepts: mobile devices, social networks and
gamification. A marketing campaign is modelled as a social workflow that
consists of a sequence of game-based activities. These activities typically involve
different stores within an indoor mall and must be successfully completed by
customers interested on getting a prize and/or a discount on a product. Some
of the proposed activities are based on customers’ location (to make a photo in
front of a store window, to pick up a coupon in a specific store or to go to an
advertising short-event, for instance). Therefore, the proposed system requires
to accurately track and determine customers’ location in indoor environments.
Outdoor localization technologies are not suitable indoors because of the
NonLine-of-Sight (NLOS) effect. To solve this problem, WiFi-based methods are a
common choice to provide indoor localization due to its many advantages: there
are WiFi access points in any indoor mall, measuring WiFi signal is free of
charge and almost every customer device (mobile phones, tablets and laptops)
has a WiFi interface.
      </p>
      <p>
        WiFi-based fingerprinting localization methods [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ][
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] require collecting WiFi
measurements at different positions covering completely the target area. The cost
in time and effort to collect the required measurements in wide areas, such as an
indoor mall, is too high and, besides, these measurements must be periodically
updated. To solve this problem, we designed an algorithm to estimate the WiFi
signal at positions not site-surveyed during the training stage [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. This method
reduces the effort of collecting signal measurements and it has proved to be
really useful to locate customers in this type of environments. Nevertheless, the
computational cost of the method is too high to be used in wide areas, as is the
case of indoor malls. Therefore, the location of the device can not be estimated
in real time if the localization process is computed over a mobile device or a
conventional computer. To be able to provide real-time positioning, the
localization process has to be performed within a few seconds. To achieve this objective,
in this paper we propose a new and efficient version of the location method
based on the use of parallel programming techniques and the cloud computing
paradigm. The functionality of the method is published by two Web-accessible
services and deployed in the Amazon-EC2 Cloud environment. Different
cloudbased deployments are evaluated to analyse the performance improvements of
the proposal with respect to the original method.
      </p>
      <p>The rest of the paper is organized as follows. The proposed localization
method and the computational cost is described in Section 2. Section 3 and
Section 4 detail the parallel service for user’s location and how this service has
been deployed in Amazon EC2, respectively. Finally, Section 5 presents the
conclusions and future work.
2</p>
    </sec>
    <sec id="sec-2">
      <title>A WiFi-based location method</title>
      <p>reference surface will correspond with the estimated RSS from a different AP
(Access Point).</p>
      <p>After that, during the localization stage, a new sample collected at an
unknown position will be used to estimate the real location of the user’s device.
The RSS from each AP will be searched in the corresponding reference surface
and a new sub-surface will be created by means of the assignation of scores to the
coordinates of the environment depending on how similar is the collected RSS
with the stored one. This way, the coordinate will obtain the maximum score
(equal to one) if the RSS exactly matches the value stored in the corresponding
surface and will be reduced accordingly to the difference between the measured
and the stored values.</p>
      <p>Once the sub-surfaces for all the APs are computed, they are summed up to
obtain a resulting surface containing higher scores as the coordinates are more
probable to be the real location of the device. However, as the complete surface
could contain non-reachable areas by the users (e.g. storage rooms at shops), a
mask is applied in order to remove the non-reachable areas. Therefore, the most
probable location of the user’s device will be the one with the highest score in
the masked resulting surface.</p>
      <p>It is important to highlight that the time required to process the continuous
reference surfaces and to obtain the device location during the localization stage
will depend on two variables chosen during the design of the localization system:
the number of the APs and the resolution of the system.</p>
      <p>
        In this paper, the experimental environment has been set up in a
mediumsize indoor scenario (around 2500m2). Although the use of cells with 15cm-side
was proved to be the most effective [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], the environment has been divided into
1cm-side cells to evaluate the performance of the proposed system as is were
tested in a bigger environment (equivalent to a 562000m2 scenario divided in
15cm cells). All the detected APs (a total of 100) have been used to perform the
localization. As a consequence, 100 surfaces composed of 25 millions of cells will
be used by the localization method. With this configuration, the execution times
are 44.4 hours to compute all maps during the training stage and 325 seconds
per location request. The experiments were conducted using a server with 8 Intel
i7-4790K CPUs at 4.00GHz, a local SSD disk and 32GB of RAM.
      </p>
      <p>These times must be improved to offer an efficient response from the point
of view of BAI4SOW system, especially during the localization stage, as the
solution must be able to locate hundreds of customers that are simultaneously
participating in a marketing campaign. The proposed solution to solve this
problem will be described in the following sections.
3</p>
    </sec>
    <sec id="sec-3">
      <title>A parallel service for WiFi-based users location</title>
      <p>Two issues must be addressed to integrate the WiFi-based location method into
the BAI4SOW system. On the one hand, the execution time of algorithms must
be reduced to locate efficiently customers in a medium-size indoor mall. We
propose the design and programming of a new parallel version of these algorithms.
This new version is based on a master-worker architecture that can be executed
in a concurrent or distributed execution environment. And, on the other hand,
it is necessary that these new algorithms are deployed in high-performance
computing resources while their functionality is easily accessible from BAI4SOW
applications. For these reasons, we have decided to integrate them into RESTful
Web services that will be executed in the Amazon cloud infrastructure.</p>
      <p>In the following sections we detail the solutions proposed to overcome the
two introduced issues.
3.1</p>
      <p>A parallelization strategy based on the master-slave
architecture
In software engineering, a master-worker architecture is a high-level design
pattern that facilitates the parallel execution of applications composed by a set
of independent tasks. The pattern consists of two class of processes: a master
and a pool of workers. The former is responsible of assigning tasks to workers
and guaranteeing that all of them are correctly completed; whereas the workers
simply execute the assigned tasks by returning the corresponding results to the
master. This architectural model is highly scalable by increasing (or decreasing)
the size of pool according to the execution requirements. It also facilitates the
deployment of the solution in a distributed computing environment, such as in
a cloud infrastructure, for instance.</p>
      <p>The training and location algorithms can be programmed as a master-worker
system. On the one hand, the process of creating a continuous reference surface
is an independent task computed from RSS measures. Therefore, the generation
of the different surfaces can be parallelized in order to accelerate the original
solution. On the other hand, the location algorithm requires checking the sample
of the customer’s unknown position against to each of the reference surfaces.
These checks are independent and, therefore, can be also programmed as parallel
tasks.
The parallelization of these algorithms has consisted of two stages. Firstly,
we have implemented a generic master-worker architecture that can be easily
customized and reused for solving different problems. The architecture was
developed using the Java programming language. Figure 2 shows an abstraction
of the proposed architecture. The configuration file determines the number of
workers and the IP addresses of the computing instances where they will be
executed. On the other hand, the application file describes the set of tasks to be
completed (task’s identification, input parameters and output results, mainly).
The master node uses the configuration data for deploying and managing the
workers. Then, it assigns tasks to the workers so that they are always busy.
Besides, the task’s and workers’ state are monitored in order to guarantee the
fault tolerance of the system. On the other hand, the data involved in solving
the problem are stored into a shared database. This reduces the data transfers
among the processes.</p>
      <p>The second stage of the parallelization consists of dividing the original
algorithms in a set of independent tasks than can be executed in parallel. Loop-level
parallelization techniques has been applied to code the new version of both
algorithms. Besides, all the MATLAB code used to create and process the reference
surfaces has been converted to Octave code. This decision is based on economic
criteria: running MATLAB code in cloud instances represents an additional cost
because of the licences required.
3.2</p>
      <p>Parallel algorithms as RESTful services executed on the cloud
Once the algorithms have been parallelized, the goal is to make them accessible
to BAI4SOW applications. We decided to integrate them into two RESTful
Web services that were published as part of the BAI4SOW infrastructure. This
approach allows any application connected to the network to make use of them.</p>
      <p>Figure 3 shows the cloud-based implementation of the system. The Surface
Creation Service (SCS) provides operations to submit training measures and
compute the corresponding continuous reference surfaces. The master-worker
version of the corresponding algorithm has been integrated into the logic of
the service and it has been deployed into the Amazon EC2 infrastructure. The
flexibility of the master-worker architecture allows us to deploy the service over
a concurrent environment (using an only virtual instance that has a high number
of CPU cores) or a distributed environment (using a pool of virtual instances).
In both cases the data are stored into the Amazon S3 service.</p>
      <p>On the other hand, the Location Service (LS) offers functionality to estimate
users’ location. RSS samples measured by the user’s mobile are aggregated and
sent to the service as input parameters. These are processed by the
masterworker version of the location algorithm which checks them against the reference
surfaces previously computed (therefore, the Amazon S3 storage is shared by
both services). Finally, the service can be also deployed over a concurrent or
distributed environment.</p>
      <p>Because the services are deployed in the cloud it is necessary to select the
computing resources to be provisioned according to the BAI4SOW applications’
requirements. The execution times and costs are briefly analysed and discussed
in the following section.
4</p>
    </sec>
    <sec id="sec-4">
      <title>Time and cost analysis for deploying the services in the</title>
    </sec>
    <sec id="sec-5">
      <title>Amazon EC2</title>
      <p>In this evaluation an user has freely walked in the environment described in
Section 2. During the walk, the user’s mobile has measured 300 RSS values in
different positions and a location request has been sent for each of these values to
determine her/his location. Previously, 100 reference surfaces with an accuracy
of 1 centimetre were computed to be used by the location method.</p>
      <p>
        In this scenario we are interested in configuring different service deployments
in the Amazon EC2 cloud and comparing their execution times and costs. Some
decisions related to the provisioning of resources are based on our experience
in the deployment of cloud-based systems [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. The goal is to evaluate the time
and cost of creating the surfaces (Phase1), responding all the location requests
(Phase2), and completing the experiment for each of the proposed deployments.
In the case of Phase2, the time per request can be calculated by dividing Time
Phase2 by 300. We have solved the experiment executing the sequential version
of algorithms in a server with 8 Intel cores i7-4790K CPUs at 4.00GHz and
32GB of RAM. The overall execution time was 44.4 hours, and the experiment
had no costs.
      </p>
      <p>Table 1 shows the execution times of the parallel algorithms by considering
different deployments in the Amazon EC2 infrastructure. First, different models
of R4 virtual instances have been hired following an on-demand schema in order
to evaluate a concurrent deployment. These instances are optimized for
memoryintensive applications, and they can offer a good performance for this type of
processing problems. The number of cores and the memory of these instances
are specified in the second and third columns of Table 1, respectively. As it
is shown, the r4.xlarge instance suffered memory problems and the experiment
was not successfully completed. The other three R4 instance models execute
correctly the experiment and present a linear speedup according to the number of
available cores. The best execution time was achieved by the r4.8xlarge instance
(4.2 hours) which improves an order of magnitude the time of the sequential
version (44.4 hours). On the other hand, the cost of experiments (column Total
cost ) considers the costs of computing resources and of storing the data into the
Amazon S3 service. The former is calculated multiplying the cost per hour of
the selected instances (column Cost/hour ) by the total execution time (column
Total time); whereas, the second is the same in all the deployments (the size of
involved data is around 66Gb and the storage price is 0.022 e/Gb for the first
50TB/month). As a conclusion, the cost of these instances is proportional to the
number of cores and, therefore, the total cost of experiment is very similar for
all the concurrent deployments.</p>
      <p>On the other hand, we have provisioned and configured two different
distributed environments as well. These environments are composed by a pool of
three and six r4.8xlarge instances, respectively. Let us to remark that the
workers are now distributed between the cores of the different instances. Therefore, a
maximum of 95/191 workers may be running simultaneously on the provisioned
instances (the other core is occupied by the master). The total execution time
continues to improve in proportion to the available cores completing the
experiment in less than 1 hour with a pool of six instances. These results show that
the overhead of the parallelization has not a significant influence in the times.
On the other hand, the total costs slightly increased compared to the costs of
concurrent deployments, but this is due to the fact that there is an excess in the
computing capacity hired (in the first distributed deployment 96 cores are not
used during 30 minutes, for instance).
5</p>
    </sec>
    <sec id="sec-6">
      <title>Conclusions and future work</title>
      <p>In this paper we have presented a parallel and service-oriented system to improve
the execution time of a WiFi-based location method. The system is based on
the master-worker architecture and has been tested and deployed in the cloud.
The experimental validation has shown a significant improvement in execution
time with respect to the sequential solution.</p>
      <p>As future work, we are interested in validating the system in a real indoor
mall (with hundreds of mobile users participating in a marketing campaign) and
in considering new deployments based on the mobile-edge computing paradigm
to reduce the communication latency between mobile users and services.</p>
    </sec>
    <sec id="sec-7">
      <title>Acknowledgment</title>
      <p>This work has been partially supported by the Ctedra de Ingeniera Avanzada
Escribano of the UAH (Catedra2017-005), the TIN2017-84796-C2-2-R project,
granted by the Spanish Ministry of Economy, Industry and Competitiveness,
and the JIUZ-2018-TEC-04 project, granted by the Ibercaja Foundation (UZ).</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1. A´lvarez,
          <string-name>
            <surname>P.</surname>
          </string-name>
          , Herna´ndez,
          <string-name>
            <given-names>S.</given-names>
            ,
            <surname>Fabra</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            ,
            <surname>Ezpeleta</surname>
          </string-name>
          , J.:
          <article-title>Cost-driven provisioning and execution of a computing-intensive service on the Amazon EC2</article-title>
          .
          <source>The Computer Journal</source>
          <volume>61</volume>
          (
          <issue>9</issue>
          ),
          <fpage>1407</fpage>
          -
          <lpage>1421</lpage>
          (02
          <year>2018</year>
          ). https://doi.org/10.1093/comjnl/bxy006
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Drucker</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Burges</surname>
            ,
            <given-names>C.J.C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kaufman</surname>
          </string-name>
          , L.,
          <string-name>
            <surname>Smola</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Vapnik</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          :
          <article-title>Support vector regression machines</article-title>
          .
          <source>Advances in Neural Information Processing Systems</source>
          <volume>9</volume>
          (
          <issue>9</issue>
          ),
          <fpage>155</fpage>
          -
          <lpage>161</lpage>
          (
          <year>1997</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3. Hern´andez, N., Ocan˜a,
          <string-name>
            <given-names>M.</given-names>
            ,
            <surname>Alonso</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.M.</given-names>
            ,
            <surname>Kim</surname>
          </string-name>
          , E.:
          <article-title>Continuous space estimation: Increasing wifi-based indoor localization resolution without increasing the site-survey effort</article-title>
          .
          <source>Sensors</source>
          <volume>17</volume>
          (
          <issue>1</issue>
          ),
          <volume>147</volume>
          (
          <year>2017</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Kim</surname>
            , J., Han,
            <given-names>D</given-names>
          </string-name>
          .:
          <article-title>Passive WiFi fingerprinting method</article-title>
          .
          <source>In: 2018 International Conference on Indoor Positioning and Indoor Navigation (IPIN)</source>
          . pp.
          <fpage>1</fpage>
          -
          <lpage>8</lpage>
          (
          <year>2018</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Lama</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>A</surname>
          </string-name>
          ´lvarez,
          <string-name>
            <surname>P.</surname>
          </string-name>
          , Ocan˜a,
          <string-name>
            <given-names>M.</given-names>
            ,
            <surname>Mucientes</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            ,
            <surname>Ezpeleta</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            ,
            <surname>Garrido</surname>
          </string-name>
          ,
          <string-name>
            <surname>M.</surname>
          </string-name>
          <article-title>A´ .: Ana´lisis inteligente de flujos de trabajo sociales</article-title>
          . In: Jornadas de Ciencia e Ingeniera de Servicios (JCIS).
          <source>Sistedes</source>
          (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Li</surname>
            ,
            <given-names>W.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Wei</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Yuan</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ouyang</surname>
          </string-name>
          , G.:
          <article-title>A novel method of WiFi fingerprint positioning using spatial multi-points matching</article-title>
          .
          <source>In: Proceedings of the 2016 International Conference on Indoor Positioning and Indoor Navigation</source>
          . pp.
          <fpage>1</fpage>
          -
          <lpage>8</lpage>
          (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>