Differences from featuremeshd

What a Python process with embedded serving does differently from featuremeshd, capability by capability, and what to do about it. Everything not listed here behaves as the featuremeshd reference says.

featuremeshd is a service: it consumes streams, keeps a clock, syncs its registry and reports. The library runs when your process calls it, and leaves those jobs to the process it runs in. The limits of hooks and views in featuremeshd apply to it too ( Precomputing features , Materialized views ).

The stream

CapabilityfeaturemeshdPythonConsequence or workaround
Consumingconsumes each event hook's topic, with a consumer group, partition ownership and rebalances ( Configure featuremeshd )never connects to Kafka. run_event_hook takes the records your consumer polledRun your own consumer. Several Python consumers in one group share its partitions as Kafka assigns them
Connectionthe stream's WITH properties: SECURITY_PROTOCOL, SASL_MECHANISM, USERNAME, PASSWORD, SSL_* ( Connections )not readConfigure your consumer. With confluent_kafka: security.protocol, sasl.mechanism, sasl.username, sasl.password, ssl.ca.location
Consumer groupthe hook's name, behind kafka_group_prefix when it is set ( Consumer groups )your consumer's group.id. The library never sets it, and kafka_group_prefix does not applyTo share or take over featuremeshd's group, use its name, prefix included
Offsetscommitted per batch, after the batch is writtenyours to commitCommit, per partition, the offset after the batch's last record, once run_event_hook has returned
STARTapplied to each partition without a committed offset when the hook first subscribes; a partition added later is read from its beginningnot read'earliest' and 'latest' are your consumer's auto.offset.reset. For an interval, before subscribing, commit for each partition without a committed offset (consumer.committed) the offset offsets_for_times gives for now minus the interval, or the partition's end (get_watermark_offsets) when it has none. Keep auto.offset.reset at earliest for partitions added later

The loop that does all of this, with retries and a tick thread, is in Feed hooks from your own pipeline .

Retries

CapabilityfeaturemeshdPythonConsequence or workaround
A failed batchretried with backoff, from 200 ms to 30 seconds, until its stores answer; the hook is STALLED meanwhile ( Failures in a batch )run_event_hook tries once. A source, sink or queue that does not answer raises RuntimeErrorRetrying is delivery, so it is yours: hand the same records in again, with your own backoff, or stop. The sinks the failed attempt wrote are written again
Poison isolation in a batchcalls still failing on a source after poison_after (2 minutes), while others succeed, become data errorsnone for an event batch: each call of run_event_hook is a new attempt. A source that keeps failing for one key fails the batch every timeSet that record aside after your own number of attempts, and commit past it
Poison isolation in a drainas for a batch, counted from the drain's first failed attemptthe same, while your tick keeps calling run_due_hooks()None needed

The clock

CapabilityfeaturemeshdPythonConsequence or workaround
Drainsevery EVERY of the hookwhen you call run_due_hooks(). A hook's EVERY is not readYour tick's period is the drain period. When you call decides each drain's REQUEST_TIME() and which entries have passed their EXPIRE
Viewseach slot of the SCHEDULE, retried until it lands or the next slot is due ( Runs )when you call run_due_materialized_views(); a failed slot is run again by the next callCall it from your tick, or from your scheduler. Keep the tick's period plus its longest run well under the shortest EXPIRE, or run views in a thread of their own
Retention sweepdeletes table rows past their RETENTION every minute ( Retention )no sweep. Redis values and indexes expire on their ownDelete old table rows yourself, or keep the data in Redis
RECOMPUTE MATERIALIZED VIEWa statement sent to featuremeshdrefused by client.query() (UE/MATERIALIZED-VIEW-RECOMPUTE-SERVING-ONLY)Call recompute_materialized_view(view)
Test controlsTEST SERVING … and a call's request_time, with serving.test_controls ( Test commands )refused: TEST SERVING is not a command here, and request_time raises ValueErrorDrive time by when you call. Test time-dependent behavior on featuremeshd

Definitions

CapabilityfeaturemeshdPythonConsequence or workaround
Registrythe registry it syncs from, every 60 seconds by defaultthe local registry file only. A remote registry with embedded serving is refused when the client is builtRegister the definitions in each process's local registry, from the same FeatureQL files
Syncat each sync, and at RECOMPILE SERVINGwhen the client is created, and at each RECOMPILE SERVING. Never on its ownEach process runs its own RECOMPILE SERVING after a change
A password in clearrefused by the hosted registry (SOURCE-INLINE-PASSWORD)stored by the local registry with a warningUse SECRET() all the same, so the definitions move to the hosted registry unchanged ( No password in clear )

Status and metrics

CapabilityfeaturemeshdPythonConsequence or workaround
StatusSHOW SERVING STATUS per replicaSHOW SERVING STATUS through client.query(), and hooks_status(), for this processRead them in the process that runs the hooks
Recent writesSHOW SERVING WRITESrefusedRead the counts and the errors sample of each report
Metrics, alerts, healthOpenTelemetry metrics, a health port ( Metrics )noneExport the reports' counts with your own metrics, and alert on them
Usagecounted and reported to the registry at each sync, never a key or a value ( Status and writes )stays in your process: nothing is sent to FeatureMeshCounts are in hooks_status()

Logging

CapabilityfeaturemeshdPythonConsequence or workaround
Deliveryafter the response, through a bounded queue ( Delivery )synchronous, in the caller's thread, before the call returnsA slow handler slows every call: enqueue in the handler, ship from another thread ( Logging from Python )
SinksParquet and JSON lines, to files, object stores and stdout://without a log_handler, JSON lines only, to stdout:// and to file:// sinks with FORMAT = 'jsonl'. A logger to any other sink, a file:// sink left to the Parquet default included, is ERRORWrite file:// sinks WITH (FORMAT = 'jsonl'), or give the client a log_handler: every sink is then a routing key

One runner per hook

featuremeshd replicas share a hook: the consumer group splits its partitions, and a lease in the queue's store gives each drain one holder. A Python process and featuremeshd must not both run the same hook. Each would consume with its own offsets and write the same keys.

  • featuremeshd to Python. Drop the hook from featuremeshd's registry, or turn its hooks off (serving.hooks.enabled). Once its consumer has left the group, start yours with group.id set to the hook's name, prefix included. It resumes from the offsets featuremeshd committed.
  • Python to featuremeshd. Stop your consumer and your tick. Once your consumer has left the group, create the hook in featuremeshd's registry and run RECOMPILE SERVING. featuremeshd's consumer resumes from your group's offsets when your group.id was the hook's name, prefix included, and applies START otherwise.
  • Queues. A drain's lease is kept in the queue's own store. Several processes can tick one queue: one drains it at a time.
  • Views. A view's lease is in the registry that runs it. Processes that run views share one registry file. featuremeshd keeps its leases in the registry it syncs from, so a view run by both would run each slot twice: run each view in one place. A run's number always starts above the run its sinks published, so a view moved between the two is never fenced out of its sinks.

Platforms

featuremesh[serving] installs featuremesh-serving-runtime, a native wheel:

PythonLinux x86_64Linux aarch64macOS arm64 (11 or later)
3.12yesyesno
3.13yesyesyes
3.14yesyesno

The Linux wheels need glibc 2.17 or later (manylinux2014). Elsewhere, pip install featuremesh still gives batch analytics, and a client asking for embedded serving raises ImportError.

The process

CapabilityfeaturemeshdPythonConsequence or workaround
CallsHTTP (port 10090) and gRPC, from any clientin-process calls only, from the process that created the clientExpose your own API, or run featuremeshd
Forksnot applicablea client used after a fork raises RuntimeErrorCreate the client in each worker process, after the fork
MemoryFEATUREMESHD_MEMORY_LIMIT_MB, 1 GiB by defaultset_default("serving.memory_limit_bytes", …), in bytes, 1 GiB by default, before the client is createdOne limit per client, shared by its calls and view runs

Related