I have read the OrientDB documentation on network binary protocol tokens but it is unclear to what extent tokens can be shared in a typical web application. Imagine the following scenario:
- One central OrientDB database configured with a global username/password pair for the web application.
- 20 load-balanced web servers connect to the central OrientDB database.
- Each of the 20 load-balanced web servers have 100 unique visitors (2,000 total sessions).
- Each unique visitor session generates 20 pageviews (40,000 total pageviews).
- Each (PHP) pageview connects to OrientDB (PhpOrient) using network binary protocol and runs one or more database queries (40,000 total OrientDB socket connections).
Question 1: Given this scenario, which token-sharing approach would be most performant for the overall system?
- Connect to OrientDB with username/password pair on every pageview. i.e. don't use tokens at all.
- Connect to OrientDB with username/password for each unique visitor, then store token to user session and reuse for each pageview (2,000 tokens)
- Make each web server connect to OrientDB with username/password ONCE, then reuse that token for all socket connections coming from that server (20 tokens).
- Make the overall system authenticate to OrientDB with username/password ONCE, and then share that same token across all the web servers (1 token).
Question 2: Under what circumstances does an OrientDB token expire?