Skip to content

Commit

Permalink
java now is using 3/4th of the physical memory (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
006627 committed Jun 27, 2019
1 parent d361abf commit e6d17c6
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 5 deletions.
27 changes: 24 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# db-visualization-toolkit-electron
Electron deployment for [db-visualization-toolkit](https://github.com/keeps/db-visualization-toolkit)

A cross-platform app built on [Electron](http://electronjs.org) that uses [Database Visualization Toolkit](https://github.com/keeps/db-visualization-toolkit) as a viewer for relational databases.

## Installing

You can download the latest release for your operating system [here](https://github.com/keeps/db-visualization-toolkit-electron/releases/latest).


#### For Linux
- Download [AppImage](https://github.com/keeps/db-visualization-toolkit-electron/releases/latest) file
- Use chmod u+x on the downloaded file to make it executable.

#### For Mac
- Download [dmg](https://github.com/keeps/db-visualization-toolkit-electron/releases/latest) file
- Double-click on the downloaded file to expand the contents.
- Drag dbvtk-gui to the Applications folder

#### For Windows
- Download [exe](https://github.com/keeps/db-visualization-toolkit-electron/releases/latest) file
- Once it is downloaded, run the installer (dbvtk-gui.exe).

**This app will automatically update when a new release is available.**

## Building
You'll need [Node.js](https://nodejs.org) installed on your computer in order to build this app.
Expand All @@ -21,15 +42,15 @@ More information about these tools can be found at http://database-preservation.

## To report a problem or make a suggestion

Create a new issue at https://github.com/keeps/db-visualization-toolkit/issues/new
Create a new issue at https://github.com/keeps/db-visualization-toolkit-electron/issues/new

Or if the problem/suggestion is related to the Database Preservation Toolkit, create the issue at https://github.com/keeps/db-preservation-toolkit/issues/new

## Information & Commercial support

For more information or commercial support, contact [KEEP SOLUTIONS](http://www.keep.pt/contactos/?lang=en).

## Development [![Build Status](https://travis-ci.org/keeps/db-visualization-toolkit.png?branch=master)](https://travis-ci.org/keeps/db-visualization-toolkit)
## Development [![Build Status](https://travis-ci.org/keeps/db-visualization-toolkit-electron.png?branch=master)](https://travis-ci.org/keeps/db-visualization-toolkit-electron)

## License

Expand Down
14 changes: 12 additions & 2 deletions app/components/dbvtk.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const waitOn = require('wait-on');
const path = require('path');
const fs = require('fs');
const tmp = require('tmp');
const os = require("os");
const { getjavaVersionAndPath } = require('../helpers/javaHelper');

module.exports = class Dbvtk {
Expand Down Expand Up @@ -33,15 +34,24 @@ module.exports = class Dbvtk {

async createProcess() {
let java = getjavaVersionAndPath();

let serverPortFile = tmp.tmpNameSync();
console.log("Port file at " + serverPortFile);

let jvmLog = tmp.tmpNameSync();
console.log("JVM log at " + jvmLog);

// get 3/4th of physical memory for set maximum heap size
// This value must be a multiple of 1024
let maxHeapMemory = Math.floor(os.totalmem() * 3 / (4 * 1024)) * 1024;
console.log("Max HEAP: " + (maxHeapMemory / Math.pow(1024, 3)).toFixed(2) + " GB");

// Ask for a random unassigned port and to write it down in serverPortFile
var javaVMParameters = ["-Dserver.port=0", "-Dserver.port.file=" + serverPortFile];
let javaVMParameters = [
"-Dserver.port=0",
"-Dserver.port.file=" + serverPortFile,
"-Xmx" + maxHeapMemory
];

this.process = spawn(java.path, ['-jar'].concat(javaVMParameters).concat("resources/war/" + this.filename), {
cwd: app.getAppPath().replace('app.asar', 'app.asar.unpacked') + '/'
Expand Down

0 comments on commit e6d17c6

Please sign in to comment.