Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate Timeout Error #53

Closed
kevinxin90 opened this issue Feb 5, 2021 · 4 comments
Closed

Investigate Timeout Error #53

kevinxin90 opened this issue Feb 5, 2021 · 4 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@kevinxin90
Copy link
Contributor

{
  "message": {
    "query_graph": {
      "nodes": {
        "n00": {
          "id": "name:Imatinib",
          "category": "biolink:ChemicalSubstance"
        },
        "n01": {
          "category": "biolink:Disease"
        },
        "n02": {
            "category": "biolink:Gene"
        }
      },
      "edges": {
        "e00": {
          "subject": "n00",
          "object": "n01",
          "predicate":"biolink:treats"
        },
        "e01": {
          "subject": "n01",
          "object": "n02",
          "predicate":"biolink:caused_by"
        }
      }
    }
  }
}

Above query results in a 504 timeout error in current BTE app. Need to investigate how that happens and how to set timeout on either express.js end or nginx end.

@kevinxin90 kevinxin90 added the bug Something isn't working label Feb 5, 2021
@kevinxin90 kevinxin90 added this to the 2021-2-26 milestone Feb 5, 2021
@kevinxin90 kevinxin90 self-assigned this Feb 5, 2021
@kevinxin90
Copy link
Contributor Author

The issue is caused by nginx settings on the server.

Based on this post.

We can update the nginx settings on the server located at /etc/nginx/nginx.conf

Add the following lines in the http section (note this set the timeout to be 5mins, can increase if needed.):

http {
fastcgi_read_timeout 300;
proxy_read_timeout 300;
}

Then reload nginx config

sudo service nginx reload

@kevinxin90
Copy link
Contributor Author

Screen Shot 2021-02-11 at 10 09 21 AM

Based on the log, it seems API query completes in a reasonable amount of time. However, it takes extremely long time to update node with the results (1 mins). Need to investigate why it takes such a long time.

@kevinxin90
Copy link
Contributor Author

Screen Shot 2021-02-13 at 5 06 35 PM

Previously, for each association, we update the knowledge graph (inputNode, outputNode, edge) using javascript spread operation. This is very inefficient. Now, it will first check if node/edge exists in knowledge graph, and then directly using dict assignment operation, which significantly reduce the time for this process.

Also, for nodeUpdate (which updates qNode with equivalent identifiers), we also apply the same logics and significantly cuts down the query time.

Now this query is able to completes within 20 seconds.

@kevinxin90
Copy link
Contributor Author

Implemented in: ea23686

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant