-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add Hazelcast as an online store #3523
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Hazelcast online store | ||
|
||
## Description | ||
|
||
Hazelcast online store is in alpha development. | ||
|
||
The [Hazelcast](htpps://hazelcast.com) online store provides support for materializing feature values into a Hazelcast cluster for serving online features in real-time. | ||
In order to use Hazelcast as online store, you need to have a running Hazelcast cluster. You can create a cluster using Hazelcast Viridian Serverless. See this [getting started](https://hazelcast.com/get-started/) page for more details. | ||
|
||
* Each feature view is mapped one-to-one to a specific Hazelcast IMap | ||
* This implementation inherits all strengths of Hazelcast such as high availability, fault-tolerance, and data distribution. | ||
* Secure TSL/SSL connection is supported by Hazelcast online store. | ||
* You can set TTL (Time-To-Live) setting for your features in Hazelcast cluster. | ||
|
||
Each feature view corresponds to an IMap in Hazelcast cluster and the entries in that IMap corresponds to features of entities. | ||
Each feature value stored separately and can be retrieved individually. | ||
|
||
## Getting started | ||
|
||
In order to use Hazelcast online store, you'll need to run `pip install 'feast[hazelcast]'`. You can then get started with the command `feast init REPO_NAME -t hazelcast`. | ||
|
||
|
||
## Examples | ||
|
||
{% code title="feature_store.yaml" %} | ||
```yaml | ||
project: my_feature_repo | ||
registry: data/registry.db | ||
provider: local | ||
online_store: | ||
type: hazelcast | ||
cluster_name: dev | ||
cluster_members: ["localhost:5701"] | ||
key_ttl_seconds: 36000 | ||
``` | ||
|
||
## Functionality Matrix | ||
|
||
| | Hazelcast | | ||
| :-------------------------------------------------------- |:----------| | ||
| write feature values to the online store | yes | | ||
| read feature values from the online store | yes | | ||
| update infrastructure (e.g. tables) in the online store | yes | | ||
| teardown infrastructure (e.g. tables) in the online store | yes | | ||
| generate a plan of infrastructure changes | no | | ||
| support for on-demand transforms | yes | | ||
| readable by Python SDK | yes | | ||
| readable by Java | no | | ||
| readable by Go | no | | ||
| support for entityless feature views | yes | | ||
| support for concurrent writing to the same key | yes | | ||
| support for ttl (time to live) at retrieval | yes | | ||
| support for deleting expired data | yes | | ||
| collocated by feature view | no | | ||
| collocated by feature service | no | | ||
| collocated by entity key | yes | | ||
|
||
To compare this set of functionality against other online stores, please see the full [functionality matrix](overview.md#functionality-matrix). | ||
|
21 changes: 21 additions & 0 deletions
21
...python/docs/source/feast.infra.online_stores.contrib.hazelcast_online_store.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
feast.infra.online\_stores.contrib.hazelcast\_online\_store package | ||
=================================================================== | ||
|
||
Submodules | ||
---------- | ||
|
||
feast.infra.online\_stores.contrib.hazelcast\_online\_store.hazelcast\_online\_store module | ||
------------------------------------------------------------------------------------------- | ||
|
||
.. automodule:: feast.infra.online_stores.contrib.hazelcast_online_store.hazelcast_online_store | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
Module contents | ||
--------------- | ||
|
||
.. automodule:: feast.infra.online_stores.contrib.hazelcast_online_store | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
sdk/python/feast/infra/online_stores/contrib/hazelcast_online_store/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# Hazelcast Online Store | ||
|
||
This contribution makes it possible to use [Hazelcast](https://hazelcast.com/) as online store for Feast. | ||
|
||
Once the Hazelcast client configuration is given inside `feature_store.yaml` file, everything else | ||
is handled as with any other online store: schema creation, read/write from/to Hazelcast and remove operations. | ||
|
||
## Quick usage | ||
|
||
The following refers to the [Feast quickstart](https://docs.feast.dev/getting-started/quickstart) page. | ||
Only the Step 2 is different from this tutorial since it requires you to configure your Hazelcast online store. | ||
|
||
### Creating the feature repository | ||
|
||
The easiest way to get started is to use the Feast CLI to initialize a new | ||
feature store. Once Feast is installed, the command | ||
|
||
``` | ||
feast init FEATURE_STORE_NAME -t hazelcast | ||
``` | ||
|
||
will interactively help you create the `feature_store.yaml` with the | ||
required configuration details to access your Hazelcast cluster. | ||
|
||
Alternatively, you can run `feast init -t FEATURE_STORE_NAME`, as described | ||
in the quickstart, and then manually edit the `online_store` section in | ||
the `feature_store.yaml` file as detailed below. | ||
|
||
The following steps (setup of feature definitions, deployment of the store, | ||
generation of training data, materialization, fetching of online/offline | ||
features) proceed exactly as in the general Feast quickstart instructions. | ||
|
||
#### Hazelcast setup | ||
|
||
In order to use [Hazelcast](https://hazelcast.com) as online store, you need to have a running Hazelcast cluster. | ||
You can create a cluster using Hazelcast Viridian Serverless easily or deploy one on your local/remote machine. | ||
See this [getting started](https://hazelcast.com/get-started/) page for more details. | ||
|
||
Hazelcast online store provides capability to connect TLS/SSL enabled cluster or Hazelcast Viridian Serverless cluster. | ||
Following is an example to connect local cluster named "dev" running on port 5701 with SSL enabled. | ||
|
||
```yaml | ||
[...] | ||
online_store: | ||
type: hazelcast | ||
cluster_name: dev | ||
cluster_members: ["localhost:5701"] | ||
ssl_cafile_path: /path/to/ca/file | ||
ssl_certfile_path: /path/to/cert/file | ||
ssl_keyfile_path: /path/to/key/file | ||
ssl_password: <YOUR_SSL_PASSWORD> | ||
``` | ||
|
||
If you want to connect your Hazelcast Viridian cluster instead of local/remote one, specify your configuration as follows: | ||
|
||
```yaml | ||
[...] | ||
online_store: | ||
type: hazelcast | ||
cluster_name: <YOUR_CLUSTER_ID> | ||
discovery_token: <YOUR_DISCOVERY_TOKEN> | ||
ssl_cafile_path: /path/to/ca/file | ||
ssl_certfile_path: /path/to/cert/file | ||
ssl_keyfile_path: /path/to/key/file | ||
ssl_password: <YOUR_SSL_PASSWORD> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
``` | ||
|
||
#### TTL configuration | ||
|
||
TTL is the maximum time in seconds for each feature to stay idle in the map. | ||
It limits the lifetime of the features relative to the time of the last read or write access performed on them. | ||
The features whose idle period exceeds this limit are expired and evicted automatically. | ||
A feature is idle if no get or put is called on it. | ||
Valid values are integers between 0 and Integer.MAX_VALUE. | ||
Its default value is 0, which means infinite. | ||
|
||
```yaml | ||
[...] | ||
online_store: | ||
[...] | ||
key_ttl_seconds: 36000 | ||
``` | ||
|
||
### More info | ||
|
||
You can learn about Hazelcast more from the [Hazelcast Documentation](https://docs.hazelcast.com/home/). | ||
|
Empty file.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, this should be read from the enrvironment instead of being hardcoded in the
feature_store.yaml
file.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good idea, thanks! Replaced the SSL password with environment variable at dad8fc4.