# Parallel Processing Strategies for Geospatial Data in a Cloud Computing Infrastructure
## 2 Parallel Strategies and Optimization
Replacing the number of tiles (\(N\)) with the number of threads (\(T\)) in Equation (1), the theoretical speedup \(S_{\text{threading}}\) using \(T\) threads is obtained as follows:  
\[S_{\text{threading}}(T)=\frac{100}{100-P+\frac{P}{T}}. \tag{2}\]If tiling and multi-threading are combined, the effect between both must first be assessed before multiplying the respective speedup values. Indeed, the speedup with multi-threading is expected to reduce when tile size decreases. This is due to a relative increase of the processing time for tasks that can only be run in serial (e.g., to open and close a file, reading metadata). The level of parallelization \(P\) in Equation (2) must, therefore, be calculated for the respective tiling scheme applied. By estimating the theoretical speedup, different cloud computing environments with a variety of computing resources can be simulated. This was performed for two typical cloud computing environments. The first environment studied was a high throughput computing cluster. The task of the job scheduler is to create a batch of jobs for the selected tiling scheme. Each job represents a single tile on one of the available working nodes. Depending on the available resources in the cluster, a certain amount of jobs can be run in parallel, single, or multi-threaded. Medium to large-sized clusters consist of hundreds to thousands of cores. However, not all cores will be available for a single user in practice. The simulations were performed for a cluster with 512 cores available. Although this number is rather arbitrary, more general conclusions can be drawn from the simulations performed. Another limitation in a cluster environment in practice is the number of available cores for a single working node. A computing cluster typically consists of working nodes with a certain number of physical cores. Multi-threading should be restricted to the number of physical cores in the respective working nodes. Threads competing for the same processing resources will negatively impact the speedup. Two types of working nodes in the cluster were considered here: a high-performance working node of 30 cores and a working node with only 8 cores. When processing tiles in the cloud on a single virtual machine, the situation is different than when processing in a cluster. The cost of a virtual machine in the cloud increases rapidly with the amount of (virtual) cores and memory. The speedup by tiling assumes that all tiles of the selected tiling scheme are processed in parallel. However, if, due to a lack of cores or memory resources, only a subset \(n\) of the total number of tiles \(N\) can be processed in parallel, the remaining \(N-n\) tiles will have to be queued for subsequent processing. This results in extra latency that was accounted for in the optimization of the speedup. A second experiment was conducted, where the number of cores was reduced from 512 to 32 (high-end virtual machine) and 8 (lower-end virtual machine). With the total number of cores available in the virtual machine (\(C\)) fixed, the number of threads \(T\) available to process each tile can then be calculated as a floor division between \(C\) and \(n\):  
\[T=\left\lfloor\frac{C}{n}\right\rfloor. \tag{3}\]  
The speedup \(S\) to be optimized can then be expressed as:  
\[S=S_{\text{tiling}}(N)\cdot S_{\text{threading}}(\frac{C}{n})\cdot\frac{n}{N}. \tag{4}\]  
The speedup values for tiling and threading must be based on the corresponding conditions (number of tiles and threads) to take into account the effect of tiling on multi-threading as discussed above. The factor \(\frac{n}{N}\) corrects for the latency that is introduced by the fraction of tiles that can be processed in parallel. The expression still holds for a computing cluster environment with sufficient cores and memory available (\(n=N\)).