The light version (OptServerLight) is a stateless in-memory solver service, which can be started and run from the command line with no configuration.
The full version (OptServer) additionally provides job storage, user authentication, web interface and similar administrative tools.
4.1.1 Requirements and files¶
The OptServerLight consists of binaries and shared libraries present in the
binfolder of the MOSEK distribution, namely:
libmosek(with appropriate extensions as per the operating system and version). The most convenient option is to run
optserverlightdirectly from the
binfolder of MOSEK.
OptServerLight distributed with MOSEK version 10.1 is compatible with and optimized for MOSEK clients of version 10.1. Supporting clients from other major.minor MOSEK versions is not guaranteed. The general REST API is always supported.
The service runs in-memory and does not create any files on disk, except a logfile, if requested.
4.1.2 Starting OptServerLight¶
To start OptServerLight launch the binary
optserverlight.exe from the
bin folder of the MOSEK installation:
That will start the OptServerLight with the default options. A typical installation should at least customize the following most important options:
optserverlight -port 34567 -solver-timeout 10 -max-task 50 -size-limit 100000000
-portis the port number where the application listens for jobs,
-solver-timeoutis the time limit for one job (in seconds), after which the solver will be terminated,
-max-taskis the maximum number of jobs solved at once, if more jobs arrive they will be kept waiting,
-size-limitis the maximal size (in bytes) of the file that will be accepted.
Full list of configuration options with descriptions can be obtained with:
4.2.1 Try it out¶
It is possible to quickly try out the OptServer without going through the full installation process. The two options are:
Use the public instance running at https://solve.mosek.com. It is a demo with size limitations suited for testing small problems. The website has instructions and coordinates of access points.
Use the Docker image available from https://github.com/MOSEK/Dockerfiles/tree/master/optserver-demo . It will install the simplest stand-alone OptServer container with latest MOSEK version and with all dependencies installed internally.
The rest of this section describes the complete installation process.
The following are prerequisites to run OptServer:
OptServer is only available for 64bit Linux.
Access to a PostgreSQL database is required.
MOSEK binaries are required. If the OptServer is installed from a standard MOSEK distribution, then it will naturally contain the necessary files, however an external MOSEK installation can also be used.
4.2.3 Locating files¶
The relevant files of the Optimization Server are organized as reported below
Scripts and binaries
Configuration files and certificates
Runtime directory, Web interface
<MSKHOME> is the folder in which the MOSEK Optimization Suite has been installed.
To install OptServer and test the installation perform the following steps.
184.108.40.206 Run install script¶
Run the script
<MSKHOME>/mosek/10.1/opt-server/bin/install_MosekServer to configure the server. The full list of supported options can be obtained via
As a reasonable minimum the configuration should specify where to install the server, the port to listen on, the database connection string and the location of an available MOSEK installation. For example:
./install_MosekServer --inplace \
--port $PORT \
--mosekdir ../../.. \
--database-resource "host=/var/run/postgresql user=$USER dbname=$DBNAME sslmode=disable"
The install script creates a configuration file
<MSKHOME>/mosek/10.1/opt-server/etc/Mosek/server.conf which can be edited by hand if necessary.
220.127.116.11 Initialize the database¶
to initialize the database. It will use the information provided in the database connection string specified in the previous step. This step is not necessary if the database exists from a previous installation.
18.104.22.168 Initialize admin password (optional)¶
If the Web interface to the OptServer is to be used, run
to set the password for the
admin user. This step is not required if the Web GUI will not be used. Note that the GUI will only be available with SSL enabled, see Sec. 6.3 (Security).
22.214.171.124 Run the server¶
Start the server by running the script
The server will print its initial configuration and continue writing the log to a file. To obtain the full list of server options run
For debugging purposes it is convenient to use the options
./MosekServer --debug --logfile -
This will increase the amount of debug output and redirect it to standard output.
4.3 Test the installation¶
To test that the OptServer or OptServerLight is working properly locate, compile (if necessary) and run the example
opt_server_sync.* for either C, Python, Java or C#. Examples and sample data files can be found in the distribution package under
For example, assuming that MOSEK was installed in Python, one can go to the folder with Python examples and run
python opt_server_sync.py ../data/25fv47.mps $SERVER $PORT
$SERVER:$PORT points to the OptServer. If the configuration is correct the example will print a log from solving the problem and a solution summary. In case of issues the log output of the OptServer should be consulted to determine the cause.
This example also demonstrates how to use the OptServer from the MOSEK API.