Skip to content

Commit e1d7732

Browse files
committed
Updated README.md
1 parent f447376 commit e1d7732

1 file changed

Lines changed: 19 additions & 13 deletions

File tree

README.md

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
# ipgeolocation.io Database Reader
22

3-
This is a step-by-step guide on how to deploy the ipgeolocation-database-reader-2.0.0.war Java API and consume API responses.
3+
This is a step-by-step guide on how to deploy the ipgeolocation-database-reader-2.0.1.war Java API and consume API responses.
44

55
## What's New
66

7-
- For `DB-V` `DB-VI` and `DB-VII`, the security database has been updated from a single IP format to an IP range format, optimizing memory usage while providing broader IP coverage.
7+
### 2.0.1
8+
- **MMDB zero-downtime updates**: MMDB readers are now hot-swapped on update without restarting Tomcat, eliminating the 502 error window that occurred between shutdown and restart.
9+
- **Fixed MMDB crash on update**: new database files are written to a temporary path first and moved atomically to the live path, preventing the `InternalError` that occurred when a request hit the reader mid-overwrite.
10+
- **Faster database extraction**: ZIP extraction buffer increased from 1 KB to 64 KB, reducing extraction time from up to 30 minutes to seconds.
11+
12+
### 2.0.0
13+
- For `DB-V`, `DB-VI` and `DB-VII`, the security database has been updated from a single IP format to an IP range format, optimizing memory usage while providing broader IP coverage.
814

915
## Requirements
1016

1117
- JDK 8 (This reader is built and tested using JDK 1.8).
1218
- For CSV databases, at least 4-8 GB RAM (for smaller CSV databases) and maximum 16 GB RAM for larger databases like DB-IV, DB-VI, and DB-VII.
1319
- For MMDB databases, at least 2-4 GB RAM only.
14-
- ipgeolocation-database-reader-2.0.0.war provided with this archive.
20+
- ipgeolocation-database-reader-2.0.1.war provided with this archive.
1521

1622
## Basic Usage
1723

@@ -45,26 +51,26 @@ Follow the steps below (commands against each step are also provided) to deploy
4551
* Against `updateInterval` key, replace `week` value with your database subscription update interval. It can be `week`, or `month`.
4652
* Against `type` key, replace `mmdb` value with your choice of database to query from. It can be `csv`, or `mmdb`. It's default value is `mmdb` and can be skipped from configuration.
4753
* Against `autoFetchAndUpdate` key, the value can be `true` or `false`.
48-
- If set to `true`, the database reader will download the latest database as soon as it is available and will restart to load the latest database in-memory.
54+
- If set to `true`, the database reader will automatically download the latest database as soon as it is available. For MMDB, the new database is loaded in-memory without any restart or downtime. For CSV, the service restarts to reload the updated database.
4955
- If set to `false`, the database reader will not check for the updated database for you. You can send a POST request to `/database/update` endpoint to fetch and update the database in-memory if an update is available. For example, here is a cURL request: `curl --location --request POST 'http://address-to-api:8080/database/update'`
5056
- It's default value is `true` and can be skipped from configuration.
5157
- Run the WAR file (if you placed config file at default path `~/conf/ipgeolocation`)
5258
```bash
53-
java -jar -Xms6G -Xmx10G /path/to/ipgeolocation-database-reader-2.0.0.war
59+
java -jar -Xms6G -Xmx10G /path/to/ipgeolocation-database-reader-2.0.1.war
5460
```
55-
Note: Use -Xms<ram_size1> flag to set the minimum RAM and -Xmx<ram_size2> to set the maximum RAM to be allocated to execute the 'ipgeolocation-database-reader-2.0.0.war' application.
61+
Note: Use -Xms<ram_size1> flag to set the minimum RAM and -Xmx<ram_size2> to set the maximum RAM to be allocated to execute the 'ipgeolocation-database-reader-2.0.1.war' application.
5662
Note: ram_size1 is the minimum RAM, and ram_size2 is the maximum RAM allocated to the application.
5763
Note: You can deploy the WAR file in an embedded container like Apache Tomcat as well.
5864

5965
The database reader will download the latest database and load it in-memory while bootstrapping and will update the database as soon as the new update is available, if `autoFetchAndUpdate` is set to `true`.
6066

61-
**Note:** database reader needs to restart after fetching the latest database to cache the updated database in-memory because caching the database without restarting will require as much as double of the required RAM which is a very costly choice.
67+
**Note:** For MMDB, the reader hot-swaps the database in-memory with no restart and no downtime. For CSV, the reader restarts after fetching the latest database because reloading large CSV databases in-memory without a restart would require up to double the RAM.
6268

6369
### Other Ways to Provide Configurations
6470

6571
By default, the database reader will look at `~/conf/ipgeolocation/database-reader-config.yaml` path for the YAML file. You can provide the YAML configurations from your custom location as well. Let's assume that you've created the YAML configurations at `/etc/ipgeolocation/ipgeo-db-reader-conf.yaml`. Here is how you can pass it to the database reader:
6672
```bash
67-
java -Dspring.config.import=file:/etc/ipgeolocation/ipgeo-db-reader-conf.yaml -jar -Xms6G -Xmx10G /path/to/ipgeolocation-database-reader-2.0.0.war
73+
java -Dspring.config.import=file:/etc/ipgeolocation/ipgeo-db-reader-conf.yaml -jar -Xms6G -Xmx10G /path/to/ipgeolocation-database-reader-2.0.1.war
6874
```
6975

7076
### For Windows
@@ -99,25 +105,25 @@ mkdir conf\ipgeolocation
99105
* Against `updateInterval` key, replace `week` value with your database subscription update interval. It can be `week`, or `month`.
100106
* Against `type` key, replace `mmdb` value with your choice of database to query from. It can be `csv`, or `mmdb`. It's default value is `mmdb` and can be skipped from configuration.
101107
* Against `autoFetchAndUpdate` key, the value can be `true` or `false`.
102-
- If set to `true`, the database reader will download the latest database as soon as it is available and will restart to load the latest database in-memory.
108+
- If set to `true`, the database reader will automatically download the latest database as soon as it is available. For MMDB, the new database is loaded in-memory without any restart or downtime. For CSV, the service restarts to reload the updated database.
103109
- If set to `false`, the database reader will not check for the updated database for you. You can send a POST request to `/database/update` endpoint to fetch and update the database in-memory if an update is available. For example, here is a cURL request: `curl --location --request POST 'http://address-to-api:8080/database/update'`
104110
- It's default value is `true` and can be skipped from configuration.
105111
- Run the WAR file
106112
```bash
107-
java -jar -Xms4G -Xmx4G -Dspring.config.import=file:C:\\conf\\ipgeolocation\\database-reader-config.yml C:\path\to\ipgeolocation-database-reader-2.0.0.war
113+
java -jar -Xms4G -Xmx4G -Dspring.config.import=file:C:\\conf\\ipgeolocation\\database-reader-config.yml C:\path\to\ipgeolocation-database-reader-2.0.1.war
108114
```
109-
Note: Use -Xms<ram_size1> flag to set the minimum RAM and -Xmx<ram_size2> to set the maximum RAM to be allocated to execute the 'ipgeolocation-database-reader-2.0.0.war' application.
115+
Note: Use -Xms<ram_size1> flag to set the minimum RAM and -Xmx<ram_size2> to set the maximum RAM to be allocated to execute the 'ipgeolocation-database-reader-2.0.1.war' application.
110116
Note: ram_size1 is the minimum RAM, and ram_size2 is the maximum RAM allocated to the application.
111117
Note: You can deploy the WAR file in an embedded container like Apache Tomcat as well.
112118

113119
The database reader will download the latest database and load it in-memory while bootstrapping and will update the database as soon as the new update is available, if `autoFetchAndUpdate` is set to `true`.
114120

115-
**Note:** database reader needs to restart after fetching the latest database to cache the updated database in-memory because caching the database without restarting will require as much as double of the required RAM which is a very costly choice.
121+
**Note:** For MMDB, the reader hot-swaps the database in-memory with no restart and no downtime. For CSV, the reader restarts after fetching the latest database because reloading large CSV databases in-memory without a restart would require up to double the RAM.
116122

117123
Another way is not create a YAML file and provide the configurations as the command-line arguments to the `war` file. Here is how you can do that:
118124

119125
```bash
120-
java -Dipgeolocation.database.workingDirectory=/etc/ipgeolocation -Dipgeolocation.database.apiKey=YOUR_API_KEY -Dipgeolocation.database.version=DB-VII -Dipgeolocation.database.updateInterval=week -Dipgeolocation.database.type=mmdb -Dipgeolocation.database.autoFetchAndUpdate=false -jar -Xms6G -Xmx10G /path/to/ipgeolocation-database-reader-2.0.0.war
126+
java -Dipgeolocation.database.workingDirectory=/etc/ipgeolocation -Dipgeolocation.database.apiKey=YOUR_API_KEY -Dipgeolocation.database.version=DB-VII -Dipgeolocation.database.updateInterval=week -Dipgeolocation.database.type=mmdb -Dipgeolocation.database.autoFetchAndUpdate=false -jar -Xms6G -Xmx10G /path/to/ipgeolocation-database-reader-2.0.1.war
121127
```
122128

123129
## How to Get IP Geolocation

0 commit comments

Comments
 (0)