Use Cases
Bokeh server enables application code to run on a remote resource such as a webserver, but supporting user interactions within a local browser client. Bokeh server can support different use cases and interaction scenarios, depending on what processing pipelines are established and how data resources of interest are organized.
It should be emphasized that one is not restricted to just using Bokeh to implement the back-end logic of any particular application. As an integrated component of the Python software ecosystem, Bokeh interoperates with many other elements of that ecosystem, which can be leveraged to support whatever sorts of data processing are desired. This might include using: NumPy and Pandas to manipulate arrays and tabular DataFrames; SciPy and Statsmodels to fit models to data and carry out other sorts of numerical analyses; Scikit-learn, TensorFlow, Keras, and PyTorch to build and train machine learning and deep learning models; Scikit-image to execute image processing pipelines; SQLAlchemy to interface with SQL databases; NetworkX to organize data into complex networks to support graph-processing operations; and PyWavelets to analyze data using wavelet transforms. In conjunction with these and many other packages, Bokeh can be used to put an interactive front-end and visualization system on top of an endless variety of applications. In our companion roadmaps on Python for Data Science, AI with Deep Learning, and Python for High Performance, we discuss in more detail many of these and other useful packages in the Python ecosystem.
Some typical use cases might consist of:
- Having data of interest reside entirely in the server's filesystem or in a database that the server has access to, with data processing and visualizations supported through a user interface
- Having data of interest residing on each user's local machine, to be uploaded to the Bokeh server for processing and visualization
- Some hybrid of (1)+(2), where user-uploaded data gets added to some sort of persistent data store on server
We'll discuss the first two of these in more detail below.
Data on server
In this scenario, the data either reside directly on the server's filesystem, or can be accessed by the server from some other data source, such as a database either running locally on the server or remotely on a database server that can be queried. This might be a common use case in an organization that possesses a collection of data of common interest to a group of stakeholders, who can interrogate different aspects of the data through a web-based user interface.
Data on local machine
In this scenario, the data reside on a user's local machine, and the Bokeh server application is configured to enable users to upload data from their machine, have it processed by the Bokeh server, and then have images and/or processed data available for download back to the local machine. In such a configuration, user data are never stored on disk or in a database on the server — instead, they reside in memory as part of the server application after being uploaded, and are deleted from memory once that specific browser connection is closed. This might be a common use case where different users each have their own particular data files, but want to carry out a typical set of data processing and/or visualization operations for the specific data of interest. Data processing pipelines of this sort are common in a number of different fields, whereby both application logic and processing resources can be centralized, rather than requiring individuals to install their own local copies of the software and find suitable resources to run that software on.
One challenge that arises in this use case is that the manner in which one gets data onto and off of the server, which we will address in more detail in File IO.