JK
>ΦΟΡΤΩΣΗ // ΦΟΡΤΩΣΗ
ΑΡΧΙΚΟΠΟΙΗΣΗ ΠΡΟΒΟΛΗΣ
Σουίτα δοκιμών που αναλύει καθυστέρηση, κατανάλωση μνήμης και απόδοση ερωτημάτων σε γράφους και σχεσιακές βάσεις.
Επιλογή της κατάλληλης τεχνολογίας βάσης δεδομένων για κοινωνικά δίκτυα και μηχανές συστάσεων.
| Τεχνολογία | Έκδοση | Σκοπός | Γιατί επιλέχθηκε |
|---|---|---|---|
| Go | 1.25.1 | Primary language | Strong concurrency primitives, fast compilation, good driver ecosystem |
| neo4j-go-driver/v6 | v6.2.0 | Bolt protocol client for CognoDB, Neo4j, Memgraph | Official driver, supports Bolt 5.x, parameterized queries |
| go-echarts/v2 | v2.7.2 | HTML chart generation | Go-native, generates standalone HTML |
| godotenv | v1.5.1 | Environment configuration | Standard .env loading |
| net/http | stdlib | REST client for TigerGraph | No external dependency needed |
| Μέθοδος | Διαδρομή | Σκοπός |
|---|---|---|
| Cypher | MATCH (n:Person {id: $id}) RETURN n.id AS id | Point lookup — single node by ID |
| Cypher | MATCH (n:Person {region: $val}) RETURN n.id AS id LIMIT 10 | Indexed lookup — nodes by region |
| Cypher | MATCH (n:Person {id: $id})-[:FRIEND]->(m:Person) RETURN collect(m.id) | 1-hop traversal — direct friends |
| Cypher | MATCH (n:Person {id: $id})-[:FRIEND]->()-[:FRIEND]->(m:Person) RETURN collect(DISTINCT m.id) | 2-hop traversal — friends of friends |
| Cypher | MATCH (n:Person {id: $id})-[:FRIEND]->()-[:FRIEND]->()-[:FRIEND]->(m:Person) RETURN collect(DISTINCT m.id) | 3-hop traversal — extended network |
| Cypher | MATCH (n:Person) RETURN n.region AS region, count(n) AS cnt ORDER BY cnt DESC LIMIT 10 | Aggregation — region distribution |
| Cypher | CREATE (n:Person {id: $id, region: $region, ...}) | Write — create new node |
| Στήλη | Τύπος | Σημειώσεις |
|---|---|---|
| idPK | STRING | Unique constraint, indexed |
| region | STRING | Indexed |
| gender | STRING | Not indexed |
| age | STRING | Indexed (CognoDB, Neo4j, Memgraph only) |
| completion_percentage | STRING | Not indexed |
49,683 nodes extracted from SNAP soc-Pokec dataset. All properties are strings.
| Στήλη | Τύπος | Σημειώσεις |
|---|---|---|
| source_id | STRING | Person.id (from) |
| target_id | STRING | Person.id (to) |
100,000 directed relationships. No properties on edges. Many-to-many cardinality.
Directed graph: Person --[FRIEND]--> Person. Many-to-many via graph relationships (no junction table). Relationships are first-class citizens in the graph model.
Απόφαση: Use neo4j-go-driver/v6 for CognoDB, Neo4j, and Memgraph
Λόγος: All three support Bolt protocol; Cypher is logically equivalent
Οφέλη: Code reuse, consistent behavior across databases, adapter pattern isolates DB-specific behavior
Ανταλλάγματα: Cannot test database-specific optimizations; Memgraph has its own Go driver
Απόφαση: Single connection per benchmark run despite constant defining 10
Λόγος: Measure single-connection latency; avoid connection pool effects
Οφέλη: Clean latency measurement without pool contention
Ανταλλάγματα: Doesn't test connection pooling behavior
Απόφαση: One JSON object per line, append-only output
Λόγος: Stream results without loading all into memory; easy to append across runs
Οφέλη: Resilient to crashes (partial results preserved)
Ανταλλάγματα: Requires full file scan for aggregation
Απόφαση: Zero retries for benchmark queries to capture true latency
Λόγος: Network blips and failures are part of real-world performance
Οφέλη: Honest performance measurement including failure modes
Ανταλλάγματα: Network blips cause false negatives
Απόφαση: Each concurrent client creates its own database connection
Λόγος: Simulates real-world multi-client scenarios; avoids shared connection contention
Οφέλη: Realistic concurrency testing with independent connections
Ανταλλάγματα: Higher resource usage; connection limits become the bottleneck
Απόφαση: Use MERGE (upsert) instead of CREATE for node loading
Λόγος: Makes loading idempotent — running multiple times doesn't create duplicates
Οφέλη: Safe re-runs, consistent dataset state
Ανταλλάγματα: MERGE is slightly slower than CREATE due to existence checks