gnzsnz / ib-gateway-docker

Docker image with IB Gateway/TWS and IBC
https://github.com/users/gnzsnz/packages/container/package/ib-gateway
MIT License
232 stars 44 forks source link

Provide a parameter to update memory allocation #51

Closed gnzsnz closed 10 months ago

gnzsnz commented 10 months ago

Is your feature request related to a problem? Please describe

A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Provide a mechanism to Increase Memory Size for TWS. Default value does not support complex mosaic screens, with multiple charts.

Describe the solution you'd like

A clear and concise description of what you want to happen.

Have an environment variable with the desired memory value, ex TWS_JAVA_HEAP=1024

a script should replace line starting by -Xmx with the provided value

# maximum Java heap size
-Xmx768m

replace by

# maximum Java heap size
-Xmx1024m

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context or screenshots about the feature request here.

Screenshot 2023-11-30 at 14 31 01

Screenshot 2023-11-30 at 14 32 20

gnzsnz commented 10 months ago

An option to set the memory allocatio is to

  1. download the vmoptions file from the container

    docker cp tws:/opt/ibkr/ibgateway/10.26.1h/ibgateway.vmoptions .
  2. update manually

    # maximum Java heap size
    -Xmx1024m
  3. map the file as a volume in docker-compose.yml

...
  volumes:
    - ./ibgateway.vmoptions:/opt/ibkr/ibgateway/10.26.1h/ibgateway.vmoptions
gnzsnz commented 10 months ago

script POC

TWS_HEAP_SIZE=1024;export TWS_HEAP_SIZE
sed -i "s/-Xmx768m/-Xmx${TWS_HEAP_SIZE}m/g" tws.vmoptions