@@ -19,40 +19,11 @@ const MONGODB_URI = process.env.MONGODB_URI || 'mongodb://localhost:27017/parse_
1919const SERVER_URL = 'http://localhost:1337/parse' ;
2020const APP_ID = 'benchmark-app-id' ;
2121const MASTER_KEY = 'benchmark-master-key' ;
22- const ITERATIONS = parseInt ( process . env . BENCHMARK_ITERATIONS || '10000 ' , 10 ) ;
22+ const ITERATIONS = parseInt ( process . env . BENCHMARK_ITERATIONS || '1000 ' , 10 ) ;
2323
2424// Parse Server instance
2525let parseServer ;
2626let mongoClient ;
27- let proxyProcess ;
28- let proxyServerCleanup ;
29-
30- /**
31- * Start MongoDB proxy with artificial latency
32- */
33- async function startProxy ( ) {
34- const { spawn } = require ( 'child_process' ) ;
35-
36- proxyProcess = spawn ( 'node' , [ 'benchmark/db-proxy.js' ] , {
37- env : { ...process . env , PROXY_PORT : '27018' , TARGET_PORT : '27017' , LATENCY_MS : '10000' } ,
38- stdio : 'inherit' ,
39- } ) ;
40-
41- // Wait for proxy to start
42- await new Promise ( resolve => setTimeout ( resolve , 2000 ) ) ;
43- console . log ( 'MongoDB proxy started on port 27018 with 10ms latency' ) ;
44- }
45-
46- /**
47- * Stop MongoDB proxy
48- */
49- async function stopProxy ( ) {
50- if ( proxyProcess ) {
51- proxyProcess . kill ( ) ;
52- await new Promise ( resolve => setTimeout ( resolve , 500 ) ) ;
53- console . log ( 'MongoDB proxy stopped' ) ;
54- }
55- }
5627
5728/**
5829 * Initialize Parse Server for benchmarking
@@ -122,59 +93,6 @@ function resetParseServer() {
12293 Parse . serverURL = SERVER_URL ;
12394}
12495
125- /**
126- * Start a Parse Server instance using the DB proxy for latency simulation
127- * Stores cleanup function globally for later use
128- */
129- async function useProxyServer ( ) {
130- const express = require ( 'express' ) ;
131- const { default : ParseServer } = require ( '../lib/index.js' ) ;
132-
133- // Create a new Parse Server instance using the proxy
134- const app = express ( ) ;
135- const proxyParseServer = new ParseServer ( {
136- databaseURI : 'mongodb://localhost:27018/parse_benchmark_test' ,
137- appId : APP_ID ,
138- masterKey : MASTER_KEY ,
139- serverURL : 'http://localhost:1338/parse' ,
140- silent : true ,
141- allowClientClassCreation : true ,
142- logLevel : 'error' ,
143- verbose : false ,
144- } ) ;
145-
146- app . use ( '/parse' , proxyParseServer . app ) ;
147-
148- const server = await new Promise ( ( resolve , reject ) => {
149- const s = app . listen ( 1338 , ( err ) => {
150- if ( err ) {
151- reject ( err ) ;
152- } else {
153- resolve ( s ) ;
154- }
155- } ) ;
156- } ) ;
157-
158- // Configure Parse SDK to use the proxy server
159- Parse . serverURL = 'http://localhost:1338/parse' ;
160-
161- // Store cleanup function globally
162- proxyServerCleanup = async ( ) => {
163- server . close ( ) ;
164- await new Promise ( resolve => setTimeout ( resolve , 500 ) ) ;
165- proxyServerCleanup = null ;
166- } ;
167- }
168-
169- /**
170- * Clean up proxy server if it's running
171- */
172- async function cleanupProxyServer ( ) {
173- if ( proxyServerCleanup ) {
174- await proxyServerCleanup ( ) ;
175- }
176- }
177-
17896/**
17997 * Measure average time for an async operation over multiple iterations
18098 * Uses warmup iterations, median metric, and outlier filtering for robustness
@@ -384,11 +302,8 @@ async function benchmarkUserLogin() {
384302
385303/**
386304 * Benchmark: Query with Include (Parallel Include Pointers)
387- * This test uses the TCP proxy (port 27018) to simulate 10ms database latency for more realistic measurements
388305 */
389306async function benchmarkQueryWithInclude ( ) {
390- // Start proxy server
391- await useProxyServer ( ) ;
392307
393308 // Setup: Create nested object hierarchy
394309 const Level2Class = Parse . Object . extend ( 'Level2' ) ;
@@ -444,9 +359,6 @@ async function runBenchmarks() {
444359 let server ;
445360
446361 try {
447- // Start MongoDB proxy
448- await startProxy ( ) ;
449-
450362 // Initialize Parse Server
451363 console . log ( 'Initializing Parse Server...' ) ;
452364 server = await initializeParseServer ( ) ;
@@ -474,7 +386,6 @@ async function runBenchmarks() {
474386 resetParseServer ( ) ;
475387 await cleanupDatabase ( ) ;
476388 results . push ( await benchmark . fn ( ) ) ;
477- await cleanupProxyServer ( ) ;
478389 }
479390
480391 // Output results in github-action-benchmark format (stdout)
@@ -498,9 +409,6 @@ async function runBenchmarks() {
498409 if ( server ) {
499410 server . close ( ) ;
500411 }
501- await stopProxy ( ) ;
502- // Give some time for cleanup
503- setTimeout ( ( ) => process . exit ( 0 ) , 1000 ) ;
504412 }
505413}
506414
0 commit comments