Skip to content

Commit 1da1276

Browse files
committed
Initial perf test setup
1 parent a41b9f8 commit 1da1276

File tree

5 files changed

+75
-1
lines changed

5 files changed

+75
-1
lines changed

poetry.lock

Lines changed: 32 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ pytest-timeout = "2.2.0"
101101
urllib3_mock = "0.3.3"
102102
responses = ">=0.8.1"
103103
black = "^24.4.2"
104+
pytest-benchmark = "^4.0.0"
104105

105106
[tool.poetry.extras]
106107
grpc = ["grpcio", "googleapis-common-protos", "lz4", "protobuf", "protoc-gen-openapiv2"]

tests/perf/__init__.py

Whitespace-only changes.

tests/perf/docker-compose.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
services:
2+
index1:
3+
image: ghcr.io/pinecone-io/pinecone-index:latest
4+
environment:
5+
PORT: 5081
6+
INDEX_TYPE: serverless
7+
DIMENSION: 1536
8+
METRIC: cosine
9+
ports:
10+
- "5081:5081"
11+
12+
index2:
13+
image: ghcr.io/pinecone-io/pinecone-index:latest
14+
environment:
15+
PORT: 5082
16+
INDEX_TYPE: pod
17+
DIMENSION: 1536
18+
METRIC: dot-product
19+
ports:
20+
- "5082:5082"

tests/perf/test_upsert.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import random
2+
import uuid
3+
from pinecone.grpc import PineconeGRPC, GRPCClientConfig
4+
5+
# Initialize a client. An API key must be passed, but the
6+
# value does not matter.
7+
pc = PineconeGRPC(api_key="test_api_key")
8+
9+
# Target the indexes. Use the host and port number along with disabling tls.
10+
index = pc.Index(host="localhost:5081", grpc_config=GRPCClientConfig(secure=False))
11+
dimension = 3
12+
13+
def upserts():
14+
vectors = []
15+
for batch in range(0, 10):
16+
for i in range(0, 100):
17+
vectors.append((str(uuid.uuid4()), [random.random()] * dimension))
18+
index.upsert(vectors=vectors, namespace="ns2")
19+
20+
def test_upsert(benchmark):
21+
benchmark(upserts)
22+
print(index.describe_index_stats())

0 commit comments

Comments
 (0)