perf: no backup and limit time in Endpoint

no need to use backup function when ghttp used as SPARQL Endpoint;
query time is limited to 1 minute in SPARQL Endpoint by default;

by zengli
This commit is contained in:
bookug 2017-08-06 22:15:55 +08:00
parent 503c6e2bad
commit 1f3fcc966a
4 changed files with 15 additions and 2 deletions

View File

@ -1083,6 +1083,11 @@ Database::load_vstree(unsigned _vstree_size)
void
Database::check()
{
cout<<"triple num: "<<this->triples_num<<endl;
cout<<"pre num: "<<this->pre_num<<endl;
cout<<"entity num: "<<this->entity_num<<endl;
cout<<"literal num: "<<this->literal_num<<endl;
string tstr;
//unsigned pid = this->kvstore->getIDByPredicate("<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>");
//cout<<"check: pre "<<pid<<endl;

View File

@ -269,8 +269,10 @@ int initialize(int argc, char *argv[])
time_t cur_time = time(NULL);
long time_backup = Util::read_backup_time();
long next_backup = cur_time - (cur_time - time_backup) % Util::gserver_backup_interval + Util::gserver_backup_interval;
//NOTICE: no need to backup for endpoint
#ifndef ONLY_READ
scheduler = start_thread(func_scheduler);
#endif
@ -392,7 +394,7 @@ int initialize(int argc, char *argv[])
// cout << r3->content.rdbuf() << endl;
server_thread.join();
cout<<"check: server stoped"<<endl;
cout<<"check: server stoped"<<endl;
return 0;
}

View File

@ -163,6 +163,7 @@ function handleQueryExample()
"\t?s <http://www.w3.org/2000/01/rdf-schema#label> ?o . \n" +
"\t?s <http://rdf.freebase.com/ns/type.object.type> ?s2 . \n" +
"\t?s2 <http://www.w3.org/2000/01/rdf-schema#label> ?o . \n" +
"\t<http://rdf.freebase.com/ns/m.026wjqb> <http://rdf.freebase.com/ns/type.object.type> ?s2 . \n" +
"} \n";
}

View File

@ -293,7 +293,12 @@ public:
static std::string gserver_port_file;
static std::string gserver_port_swap;
static std::string gserver_log;
//NOTICE: for endpoints, just set to 1 minute
#ifdef SPARQL_ENDPOINT
static const int gserver_query_timeout = 60; // Timeout of gServer's query (in seconds)
#else
static const int gserver_query_timeout = 10000; // Timeout of gServer's query (in seconds)
#endif
static std::string backup_path;
static const long gserver_backup_interval = 86400;