Skip to content

Commit

Permalink
Initial perf test setup
Browse files Browse the repository at this point in the history
  • Loading branch information
jhamon committed Sep 20, 2024
1 parent a41b9f8 commit 1da1276
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 1 deletion.
33 changes: 32 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ pytest-timeout = "2.2.0"
urllib3_mock = "0.3.3"
responses = ">=0.8.1"
black = "^24.4.2"
pytest-benchmark = "^4.0.0"

[tool.poetry.extras]
grpc = ["grpcio", "googleapis-common-protos", "lz4", "protobuf", "protoc-gen-openapiv2"]
Expand Down
Empty file added tests/perf/__init__.py
Empty file.
20 changes: 20 additions & 0 deletions tests/perf/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
services:
index1:
image: ghcr.io/pinecone-io/pinecone-index:latest
environment:
PORT: 5081
INDEX_TYPE: serverless
DIMENSION: 1536
METRIC: cosine
ports:
- "5081:5081"

index2:
image: ghcr.io/pinecone-io/pinecone-index:latest
environment:
PORT: 5082
INDEX_TYPE: pod
DIMENSION: 1536
METRIC: dot-product
ports:
- "5082:5082"
22 changes: 22 additions & 0 deletions tests/perf/test_upsert.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import random
import uuid
from pinecone.grpc import PineconeGRPC, GRPCClientConfig

# Initialize a client. An API key must be passed, but the
# value does not matter.
pc = PineconeGRPC(api_key="test_api_key")

# Target the indexes. Use the host and port number along with disabling tls.
index = pc.Index(host="localhost:5081", grpc_config=GRPCClientConfig(secure=False))
dimension = 3

def upserts():
vectors = []
for batch in range(0, 10):
for i in range(0, 100):
vectors.append((str(uuid.uuid4()), [random.random()] * dimension))
index.upsert(vectors=vectors, namespace="ns2")

def test_upsert(benchmark):
benchmark(upserts)
print(index.describe_index_stats())

0 comments on commit 1da1276

Please sign in to comment.