Skip to content

Commit a15fcb4

Browse files
docs: Fix docs for Go feature retrieval (#2967)
* Docs Signed-off-by: Felix Wang <[email protected]> * Update production docs Signed-off-by: Felix Wang <[email protected]> * Update page name Signed-off-by: Felix Wang <[email protected]> * Update roadmap Signed-off-by: Felix Wang <[email protected]>
1 parent 1479519 commit a15fcb4

File tree

7 files changed

+124
-137
lines changed

7 files changed

+124
-137
lines changed

docs/SUMMARY.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
* [Load data into the online store](how-to-guides/feast-snowflake-gcp-aws/load-data-into-the-online-store.md)
5252
* [Read features from the online store](how-to-guides/feast-snowflake-gcp-aws/read-features-from-the-online-store.md)
5353
* [Running Feast in production](how-to-guides/running-feast-in-production.md)
54-
* [Deploying a Java feature server on Kubernetes](how-to-guides/fetching-java-features-k8s.md)
5554
* [Upgrading from Feast 0.9](https://docs.google.com/document/u/1/d/1AOsr\_baczuARjCpmZgVd8mCqTF4AZ49OEyU4Cn-uTT0/edit)
5655
* [Adding a custom provider](how-to-guides/creating-a-custom-provider.md)
5756
* [Adding a custom batch materialization engine](how-to-guides/creating-a-custom-materialization-engine.md)
@@ -93,7 +92,7 @@
9392
* [.feastignore](reference/feature-repository/feast-ignore.md)
9493
* [Feature servers](reference/feature-servers/README.md)
9594
* [Python feature server](reference/feature-servers/python-feature-server.md)
96-
* [Go-based feature retrieval](reference/feature-servers/go-feature-retrieval.md)
95+
* [Go feature server](reference/feature-servers/go-feature-server.md)
9796
* [\[Alpha\] Web UI](reference/alpha-web-ui.md)
9897
* [\[Alpha\] Data quality monitoring](reference/dqm.md)
9998
* [\[Alpha\] On demand feature view](reference/alpha-on-demand-feature-view.md)

docs/how-to-guides/fetching-java-features-k8s.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

docs/how-to-guides/running-feast-in-production.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,12 @@ This service will provide an HTTP API with JSON I/O, which can be easily used wi
242242

243243
[Read more about this feature](../reference/alpha-aws-lambda-feature-server.md)
244244

245-
### 4.3. Java based Feature Server deployed on Kubernetes
245+
### 4.3. Go feature server deployed on Kubernetes
246246

247-
For users with very latency-sensitive and high QPS use-cases, Feast offers a high-performance Java feature server.
248-
Besides the benefits of running on JVM, this implementation also provides a gRPC API, which guarantees good connection utilization and
249-
small request / response body size (compared to JSON).
250-
You will need the Feast Java SDK to retrieve features from this service. This SDK wraps all the gRPC logic for you and provides more convenient APIs.
247+
For users with very latency-sensitive and high QPS use-cases, Feast offers a high-performance [Go feature server](../reference/feature-servers/go-feature-server.md).
248+
It can use either HTTP or gRPC.
251249

252-
The Java based feature server can be deployed to Kubernetes cluster via Helm charts in a few simple steps:
250+
The Go feature server can be deployed to a Kubernetes cluster via Helm charts in a few simple steps:
253251

254252
1. Install [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) and [helm 3](https://helm.sh/)
255253
2. Add the Feast Helm repository and download the latest charts:
@@ -259,17 +257,19 @@ helm repo update
259257
```
260258
3. Run Helm Install
261259
```
262-
helm install feast-release feast-charts/feast \
260+
helm install feast-release feast-charts/feast-python-server \
263261
--set global.registry.path=s3://feast/registries/prod \
264262
--set global.project=<project name>
265263
```
266264

267-
This chart will deploy two services: `feature-server` and `transformation-service`.
268-
Both must have read access to the registry file on cloud storage. Both will keep a copy of the registry in their memory and periodically refresh it, so expect some delays in update propagation in exchange for better performance.
265+
This chart will deploy a single service.
266+
The service must have read access to the registry file on cloud storage.
267+
It will keep a copy of the registry in their memory and periodically refresh it, so expect some delays in update propagation in exchange for better performance.
268+
In order for the Go feature server to be enabled, you should set `go_feature_serving: True` in the `feature_store.yaml`.
269269

270270
#### Load balancing
271271

272-
The next step would be to install an L7 Load Balancer (eg, [Envoy](https://www.envoyproxy.io/)) in front of the Java feature server.
272+
The next step would be to install an L7 Load Balancer (eg, [Envoy](https://www.envoyproxy.io/)) in front of the Go feature server.
273273
For seamless integration with Kubernetes (including services created by Feast Helm chart) we recommend using [Istio](https://istio.io/) as Envoy's orchestrator.
274274

275275
## 5. Ingesting features from a stream source
@@ -344,8 +344,8 @@ Summarizing it all together we want to show several options of architecture that
344344
* Feast SDK is being triggered by CI (eg, Github Actions). It applies the latest changes from the feature repo to the Feast registry
345345
* Airflow manages materialization jobs to ingest data from DWH to the online store periodically
346346
* For the stream ingestion Feast Python SDK is used in the existing Spark / Beam pipeline
347-
* Online features are served via either a Python feature server or a high performance Java feature server
348-
* Both the Java feature server and the transformation server are deployed on Kubernetes cluster (via Helm charts)
347+
* Online features are served via either a Python feature server or a high performance Go feature server
348+
* The Go feature server can be deployed on a Kubernetes cluster (via Helm charts)
349349
* Feast Python SDK is called locally to generate a training dataset
350350

351351
![From Repository to Production: Feast Production Architecture](production-spark.png)

docs/reference/feature-servers/go-feature-retrieval.md

Lines changed: 0 additions & 85 deletions
This file was deleted.
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Go feature server
2+
3+
## Overview
4+
5+
The Go feature server is an HTTP/gRPC endpoint that serves features.
6+
It is written in Go, and is therefore significantly faster than the Python feature server.
7+
See this [blog post](https://feast.dev/blog/go-feature-server-benchmarks/) for more details on the comparison between Python and Go.
8+
In general, we recommend the Go feature server for all production use cases that require extremely low-latency feature serving.
9+
Currently only the Redis and SQLite online stores are supported.
10+
11+
## CLI
12+
13+
By default, the Go feature server is turned off.
14+
To turn it on you can add `go_feature_serving: True` to your `feature_store.yaml`:
15+
16+
{% code title="feature_store.yaml" %}
17+
```yaml
18+
project: my_feature_repo
19+
registry: data/registry.db
20+
provider: local
21+
online_store:
22+
type: redis
23+
connection_string: "localhost:6379"
24+
go_feature_serving: True
25+
```
26+
{% endcode %}
27+
28+
Then the `feast serve` CLI command will start the Go feature server.
29+
As with Python, the Go feature server uses port 6566 by default; the port be overridden with a `--port` flag.
30+
Moreover, the server uses HTTP by default, but can be set to use gRPC with `--type=grpc`.
31+
32+
Alternatively, if you wish to experiment with the Go feature server instead of permanently turning it on, you can just run `feast serve --go`.
33+
34+
## Installation
35+
36+
The Go component comes pre-compiled when you install Feast with Python versions 3.8-3.10 on macOS or Linux (on x86).
37+
In order to install the additional Python dependencies, you should install Feast with
38+
```
39+
pip install feast[go]
40+
```
41+
You must also install the Apache Arrow C++ libraries.
42+
This is because the Go feature server uses the cgo memory allocator from the Apache Arrow C++ library for interoperability between Go and Python, to prevent memory from being accidentally garbage collected when executing on-demand feature views.
43+
You can read more about the usage of the cgo memory allocator in these [docs](https://pkg.go.dev/github.com/apache/arrow/go/[email protected]/cdata#ExportArrowRecordBatch).
44+
45+
For macOS, run `brew install apache-arrow`.
46+
For linux users, you have to install `libarrow-dev`.
47+
```
48+
sudo apt update
49+
sudo apt install -y -V ca-certificates lsb-release wget
50+
wget https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb
51+
sudo apt install -y -V ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb
52+
sudo apt update
53+
sudo apt install -y -V libarrow-dev # For C++
54+
```
55+
For developers, if you want to build from source, run `make compile-go-lib` to build and compile the go server. In order to build the go binaries, you will need to install the `apache-arrow` c++ libraries.
56+
57+
## Alpha features
58+
59+
### Feature logging
60+
61+
The Go feature server can log all requested entities and served features to a configured destination inside an offline store.
62+
This allows users to create new datasets from features served online. Those datasets could be used for future trainings or for
63+
feature validations. To enable feature logging we need to edit `feature_store.yaml`:
64+
```yaml
65+
project: my_feature_repo
66+
registry: data/registry.db
67+
provider: local
68+
online_store:
69+
type: redis
70+
connection_string: "localhost:6379"
71+
go_feature_serving: True
72+
feature_server:
73+
feature_logging:
74+
enable: True
75+
```
76+
77+
Feature logging configuration in `feature_store.yaml` also allows to tweak some low-level parameters to achieve the best performance:
78+
```yaml
79+
feature_server:
80+
feature_logging:
81+
enable: True
82+
flush_interval_secs: 300
83+
write_to_disk_interval_secs: 30
84+
emit_timeout_micro_secs: 10000
85+
queue_capacity: 10000
86+
```
87+
All these parameters are optional.
88+
89+
### Python SDK retrieval
90+
91+
The logic for the Go feature server can also be used to retrieve features during a Python `get_online_features` call.
92+
To enable this behavior, you must add `go_feature_retrieval: True` to your `feature_store.yaml`.
93+
You must also have all the dependencies installed as detailed above.

docs/reference/feature-servers/python-feature-server.md

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,22 @@
22

33
## Overview
44

5-
The feature server is an HTTP endpoint that serves features with JSON I/O. This enables users to write + read features from Feast online stores using any programming language that can make HTTP requests.
5+
The Python feature server is an HTTP endpoint that serves features with JSON I/O. This enables users to write and read features from the online store using any programming language that can make HTTP requests.
66

77
## CLI
88

9-
There is a CLI command that starts the server: `feast serve`. By default, Feast uses port 6566; the port be overridden by a `--port` flag.
9+
There is a CLI command that starts the server: `feast serve`. By default, Feast uses port 6566; the port be overridden with a `--port` flag.
1010

1111
## Deploying as a service
1212

13-
One can also deploy a feature server by building a docker image that bundles in the project's `feature_store.yaml`. See [helm chart](https://github.com/feast-dev/feast/blob/master/infra/charts/feast-python-server) for example.
14-
15-
A [remote feature server](../alpha-aws-lambda-feature-server.md) on AWS Lambda is available. A remote feature server on GCP Cloud Run is currently being developed.
13+
One can deploy a feature server by building a docker image that bundles in the project's `feature_store.yaml`. See this [helm chart](https://github.com/feast-dev/feast/blob/master/infra/charts/feast-python-server) for an example.
1614

15+
A [remote feature server](../alpha-aws-lambda-feature-server.md) on AWS Lambda is also available.
1716

1817
## Example
1918

2019
### Initializing a feature server
21-
Here's the local feature server usage example with the local template:
20+
Here's an example of how to start the Python feature server with a local feature repo:
2221

2322
```bash
2423
$ feast init feature_repo
@@ -27,9 +26,11 @@ Creating a new Feast repository in /home/tsotne/feast/feature_repo.
2726
$ cd feature_repo
2827

2928
$ feast apply
30-
Registered entity driver_id
31-
Registered feature view driver_hourly_stats
32-
Deploying infrastructure for driver_hourly_stats
29+
Created entity driver
30+
Created feature view driver_hourly_stats
31+
Created feature service driver_activity
32+
33+
Created sqlite table feature_repo_driver_hourly_stats
3334

3435
$ feast materialize-incremental $(date +%Y-%m-%d)
3536
Materializing 1 feature views to 2021-09-09 17:00:00-07:00 into the sqlite online store.
@@ -38,8 +39,6 @@ driver_hourly_stats from 2021-09-09 16:51:08-07:00 to 2021-09-09 17:00:00-07:00:
3839
100%|████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 295.24it/s]
3940

4041
$ feast serve
41-
This is an experimental feature. It's intended for early testing and feedback, and could change without warnings in future releases.
42-
INFO: Started server process [8889]
4342
09/10/2021 10:42:11 AM INFO:Started server process [8889]
4443
INFO: Waiting for application startup.
4544
09/10/2021 10:42:11 AM INFO:Waiting for application startup.
@@ -49,7 +48,7 @@ INFO: Uvicorn running on http://127.0.0.1:6566 (Press CTRL+C to quit)
4948
09/10/2021 10:42:11 AM INFO:Uvicorn running on http://127.0.0.1:6566 (Press CTRL+C to quit)
5049
```
5150

52-
### Retrieving features from the online store
51+
### Retrieving features
5352
After the server starts, we can execute cURL commands from another terminal tab:
5453

5554
```bash
@@ -153,11 +152,9 @@ curl -X POST \
153152
```
154153

155154
### Pushing features to the online and offline stores
156-
You can push data corresponding to a push source to the online and offline stores (note that timestamps need to be strings):
157-
158-
You can also define a pushmode to push stream or batch data, either to the online store, offline store, or both. The feature server will throw an error if the online/offline store doesn't support the push api functionality.
155+
The Python feature server also exposes an endpoint for [push sources](../../data-sources/push.md). This endpoint allows you to push data to the online and/or offline store.
159156

160-
The request definition for pushmode is a string parameter `to` where the options are: ["online", "offline", "online_and_offline"].
157+
The request definition for pushmode is a string parameter `to` where the options are: ["online", "offline", "online_and_offline"]. Note that timestamps need to be strings.
161158
```text
162159
curl -X POST "http://localhost:6566/push" -d '{
163160
"push_source_name": "driver_hourly_stats_push_source",

0 commit comments

Comments
 (0)