Skip to content

Commit

Permalink
Add performance metrics to surface query service and adjust Radix con…
Browse files Browse the repository at this point in the history
…figuration for scaling
  • Loading branch information
sigurdp committed Nov 21, 2024
1 parent f1df9fd commit ee49c54
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
1 change: 1 addition & 0 deletions backend_py/primary/primary/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
logging.getLogger("primary.services.sumo_access").setLevel(logging.DEBUG)
logging.getLogger("primary.services.user_session_manager").setLevel(logging.DEBUG)
logging.getLogger("primary.services.user_grid3d_service").setLevel(logging.DEBUG)
logging.getLogger("primary.services.surface_query_service").setLevel(logging.DEBUG)
logging.getLogger("primary.routers.grid3d").setLevel(logging.DEBUG)
logging.getLogger("primary.routers.dev").setLevel(logging.DEBUG)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
from primary import config
from primary.services.sumo_access.sumo_blob_access import get_sas_token_and_blob_store_base_uri_for_case

from webviz_pkg.core_utils.perf_metrics import PerfMetrics


LOGGER = logging.getLogger(__name__)


Expand Down Expand Up @@ -51,6 +54,9 @@ async def batch_sample_surface_in_points_async(
x_coords: list[float],
y_coords: list[float],
) -> List[RealizationSampleResult]:

perf_metrics = PerfMetrics()

realization_object_ids = await _get_object_uuids_for_surface_realizations(
sumo_access_token=sumo_access_token,
case_uuid=case_uuid,
Expand All @@ -59,9 +65,15 @@ async def batch_sample_surface_in_points_async(
surface_attribute=surface_attribute,
realizations=realizations,
)


perf_metrics.record_lap("get-obj-ids")

sas_token, blob_store_base_uri = get_sas_token_and_blob_store_base_uri_for_case(sumo_access_token, case_uuid)

#LOGGER.debug(f"Token: {sas_token}")

perf_metrics.record_lap("sas-token")

request_body = _PointSamplingRequestBody(
sasToken=sas_token,
blobStoreBaseUri=blob_store_base_uri,
Expand All @@ -74,6 +86,8 @@ async def batch_sample_surface_in_points_async(
LOGGER.info(f"Running async go point sampling for surface: {surface_name}")
response: httpx.Response = await client.post(url=SERVICE_ENDPOINT, json=request_body.model_dump())

perf_metrics.record_lap("main-call")

json_data: bytes = response.content
response_body = _PointSamplingResponseBody.model_validate_json(json_data)

Expand All @@ -82,6 +96,8 @@ async def batch_sample_surface_in_points_async(
values_np = np.asarray(res.sampledValues)
res.sampledValues = np.where((values_np < response_body.undefLimit), values_np, np.nan).tolist()

LOGGER.debug(f"------------------ batch_sample_surface_in_points_async() took: {perf_metrics.to_string_s()}")

return response_body.sampleResultArr


Expand Down
10 changes: 5 additions & 5 deletions radixconfig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ spec:
cpu: 2000m
horizontalScaling:
minReplicas: 1
maxReplicas: 16
maxReplicas: 8
resources:
memory:
averageUtilization: 60
Expand All @@ -145,13 +145,13 @@ spec:
resources:
requests:
memory: 32Gi
cpu: 8000m
cpu: 32000m
limits:
memory: 32Gi
cpu: 8000m
cpu: 32000m
horizontalScaling:
minReplicas: 16
maxReplicas: 16
minReplicas: 8
maxReplicas: 8
resources:
memory:
averageUtilization: 60
Expand Down

0 comments on commit ee49c54

Please sign in to comment.