View a markdown version of this page

Suggerimento per il timeout della query OpenCypher - Amazon Neptune

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

Suggerimento per il timeout della query OpenCypher

Il comportamento di timeout delle query può essere configurato per query tramite un suggerimento di query a livello di query. QUERY:TIMEOUTMILLISECONDS Deve essere utilizzato con la clausola. USING Il suggerimento per la query accetta un valore long non negativo.

AWS CLI
aws neptunedata execute-open-cypher-query \ --endpoint-url https://your-neptune-endpoint:port \ --open-cypher-query "USING QUERY:TIMEOUTMILLISECONDS 100 MATCH(n) RETURN n LIMIT 1"

Per ulteriori informazioni, vedere https://docs.aws.amazon.com/cli/latest/reference/neptunedata/execute-open-cypher-query.html execute-open-cypher-query nel Command Reference. AWS CLI

SDK
import boto3 from botocore.config import Config client = boto3.client( 'neptunedata', endpoint_url='https://your-neptune-endpoint:port', config=Config(read_timeout=None, retries={'total_max_attempts': 1}) ) response = client.execute_open_cypher_query( openCypherQuery='USING QUERY:TIMEOUTMILLISECONDS 100 MATCH(n) RETURN n LIMIT 1' ) print(response['results'])

Per esempi di AWS SDK in altre lingue, consulta. AWS SDK

awscurl
awscurl https://your-neptune-endpoint:port/openCypher \ --region us-east-1 \ --service neptune-db \ -X POST \ -d "query=USING QUERY:TIMEOUTMILLISECONDS 100 MATCH(n) RETURN n LIMIT 1"
Nota

Questo esempio presuppone che le tue AWS credenziali siano configurate nel tuo ambiente. Sostituisci us-east-1 con la regione del tuo cluster Neptune.

curl
curl https://your-neptune-endpoint:port/openCypher \ -d "query=USING QUERY:TIMEOUTMILLISECONDS 100 MATCH(n) RETURN n LIMIT 1"

Il comportamento di timeout delle query prenderà in considerazione il timeout minimo a livello di cluster e il timeout a livello di query. Vedi gli esempi seguenti per comprendere il comportamento del timeout delle query. Per ulteriori informazioni sul timeout delle query a livello di cluster, vedere neptune_query_timeout. https://docs.aws.amazon.com/neptune/latest/userguide/parameters.html#parameters-db-cluster-parameters-neptune_query_timeout

# Suppose `neptune_query_timeout` is 10000 ms and query-level timeout is set to 100 ms # It will consider 100 ms as the final timeout curl https://your-neptune-endpoint:port/openCypher \ -d "query=USING QUERY:TIMEOUTMILLISECONDS 100 MATCH(n) RETURN n LIMIT 1" # Suppose `neptune_query_timeout` is 100 ms and query-level timeout is set to 10000 ms # It will still consider 100 ms as the final timeout curl https://your-neptune-endpoint:port/openCypher \ -d "query=USING QUERY:TIMEOUTMILLISECONDS 10000 MATCH(n) RETURN n LIMIT 1"

Se una query supera il timeout, Neptune la interrompe e restituisce un errore di timeout. L'opportunità di riprovare una query scaduta dipende dalla natura dell'errore e dal carico di lavoro. Per le linee guida, consulta Gestione di eccezioni e nuovi tentativi.