Commit eade7dd
authored
Expose connection_pool_maxsize on Index and add docstrings (#415)
## Problem
To explore the impact on performance, I want to expose a configuration
kwarg for `connection_pool_maxsize` on `Index`.
## Solution
This `connection_pool_maxsize` value is passed in to
`urllib3.PoolManager` as `maxsize`. This param controls how many
connections are cached for a given host. If we are using a large number
of threads to increase parallelism but this maxsize value is relatively
small, we can end up taking unnecessary overhead to establish and
discard connections beyond the maxsize that are being cached.
By default `connection_pool_maxsize` is set to
`multiprocessing.cpu_count() * 5`. In Google colab, cpu count is only 2
so this is fairly limiting.
### Usage
```python
from pinecone import Pinecone
pc = Pinecone(api_key='key')
index = pc.Index(
host="jen1024-dojoi3u.svc.apw5-4e34-81fa.pinecone.io",
pool_threads=25,
connection_pool_maxsize=25
)
```
## Type of Change
- [x] New feature (non-breaking change which adds functionality)
## Test Plan
I ran some local performance tests and saw this does have an impact to
performance.1 parent e668c89 commit eade7dd
2 files changed
+53
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
765 | 765 | | |
766 | 766 | | |
767 | 767 | | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
768 | 776 | | |
769 | 777 | | |
770 | 778 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
108 | 111 | | |
109 | 112 | | |
110 | 113 | | |
| |||
512 | 515 | | |
513 | 516 | | |
514 | 517 | | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
515 | 560 | | |
516 | 561 | | |
517 | 562 | | |
| |||
0 commit comments