Skip to main content

Configuration

About 4 min

Configuration

These configuration items without default values must be filled. It's highly recommended to create a new config file based on the configuration templateopen in new window. The "description" for each option links to the detailed usage of this option.

database

KeyTypeDefaultDescription
data_storestringDatabase for data storage, supports MySQL, PostgreSQL, ClickHouse and MongoDB.
cache_storestringDatabase for cache storage, supports MySQL, PostgreSQL, MongoDB and Redis.
table_prefixstringNaming prefix for tables (collections, keys) in databases.
cache_table_prefixstringNaming prefix for tables (collections, keys) in cache storage databases. If empty, table_prefix is used.
data_table_prefixstringNaming prefix for tables (collections, keys) in data storage databases. If empty, table_prefix is used.

The DSN (Database Source Name) format of the data_store and cache_store is as follows.

# TCP Connection
redis://<user>:<password>@<host>:<port>/<db_number>

# TLS Connection
rediss://<user>:<password>@<host>:<port>/<db_number>

# TCP Connection to Redis Cluster
redis+cluster://<user>:<password>@<host>:<port>/<db_number>

Document: https://pkg.go.dev/github.com/go-redis/redis/v8#ParseURLopen in new window

master

KeyTypeDefaultDescription
hoststring"0.0.0.0"Master node listening host for gRPC service (metadata exchange)
portinteger8086Master node listening port for gRPC service (metadata exchange)
http_hoststring"0.0.0.0"Master node listening host for HTTP service (dashboard and metrics)
http_portinteger8088Master node listening port for HTTP service (dashboard and metrics)
n_jobsinteger1Number of working threads for the master node
meta_timeoutinteger10sMetadata timeout
dashboard_user_namestringDashboard login username
dashboard_passwordstringDashboard login password

server

KeyTypeDefaultDescription
default_ninteger10Default number of returned items
api_keystringSecret key for RESTful APIs (SSL required)
clock_errorinteger5sClock error in the cluster
auto_insert_userbooleantrueAutomatically insert new users when inserting new feedback
auto_insert_itembooleantrueAutomatically insert new items when inserting new feedback
cache_expirestring10sServer-side cache expire time

recommend

KeyTypeDefaultDescription
cache_sizestring100Number of cached elements in cache store
cache_expirestring72hRecommended cache expire time

recommend.data_source

KeyTypeDefaultDescription
positive_feedback_typesstringTypes of positive feedback
read_feedback_typesstringType of read feedback
positive_feedback_ttlstring0Time-to-live of positive feedback
item_ttlstring0Time-to-live of items
KeyTypeDefaultDescription
popular_windowinteger4320hTime window of popular items in days

recommend.user_neighbors

KeyTypeDefaultDescription
neighbor_typestring"auto"The type of neighbors for users
enable_indexbooleanfalseEnable approximate item neighbor searching using clustering index
index_recallfloat0.8Minimal recall for approximate item neighbor searching
index_fit_epochinteger3Maximal number of fit epochs for approximate item neighbor searching clustering index

recommend.item_neighbors

KeyTypeDefaultDescription
neighbor_typestring"auto"The type of neighbors for items
enable_indexbooleanfalseEnable approximate item neighbor searching using clustering index
index_recallfloat0.8Minimal recall for approximate user neighbor searching
index_fit_epochinteger3Maximal number of fit epochs for approximate user neighbor searching clustering index

recommend.collaborative

KeyTypeDefaultDescription
model_fit_periodinteger60mPeriod of model training
model_search_periodinteger360mPeriod of model search
model_search_epochinteger100Number of training epochs for each model in model search
model_search_trialsinteger10Number of trials for each model in model search
enable_model_size_searchbooleanfalseEnable searching models of different sizes, which consume more memory
enable_indexbooleanfalseEnable approximate collaborative filtering recommend using HNSW index
index_recallfloat0.9Minimal recall for approximate collaborative filtering recommend
index_fit_epochinteger3Maximal number of fit epochs for approximate collaborative filtering recommend HNSW index

recommend.replacement

KeyTypeDefaultDescription
enable_replacementbooleanfalseReplace historical items back to recommendations
positive_replacement_decayfloat0.8Decay the weights of replaced items from positive feedbacks
read_replacement_decayfloat0.6Decay the weights of replaced items from read feedbacks

recommend.offline

KeyTypeDefaultDescription
check_recommend_periodinteger1mPeriod to check recommendation for users
refresh_recommend_periodinteger24hPeriod to refresh offline recommendation cache
enable_latest_recommendbooleanfalseEnable latest recommendation during offline recommendation
enable_popular_recommendbooleanfalseEnable popular recommendation during offline recommendation
enable_user_based_recommendbooleanfalseEnable user-based similarity recommendation during offline recommendation
enable_item_based_recommendbooleanfalseEnable item-based similarity recommendation during offline recommendation
enable_collaborative_recommendbooleantrueEnable collaborative filtering recommendation during offline recommendation
enable_click_through_predictionbooleanfalseEnable click-though rate prediction during offline recommendation. Otherwise, results from multi-way recommendation would be merged randomly
explore_recommendmap{ popular = 0.0, latest = 0.0 }The explore recommendation method is used to inject popular items or latest items into recommended result

recommend.online

KeyTypeDefaultDescription
fallback_recommendstrings["latest"]Source of recommendation when personalized recommendation exhausted
num_feedback_fallback_item_basedinteger10The number of feedback used in fallback item-based similar recommendation

Environment Variables

Part of configurations can be overwritten by environment variables.

ConfigurationEnvironment Variable
database.cache_storeGORSE_CACHE_STORE
database.data_storeGORSE_DATA_STORE
database.table_prefixGORSE_TABLE_PREFIX
database.cache_table_prefixGORSE_CACHE_TABLE_PREFIX
database.data_table_prefixGORSE_DATA_TABLE_PREFIX
master.portGORSE_MASTER_PORT
master.hostGORSE_MASTER_HOST
master.http_portGORSE_MASTER_HTTP_PORT
master.http_hostGORSE_MASTER_HTTP_HOST
master.n_jobsGORSE_MASTER_JOBS
master.dashboard_user_nameGORSE_DASHBOARD_USER_NAME
master.dashboard_passwordGORSE_DASHBOARD_PASSWORD
server.api_keyGORSE_SERVER_API_KEY