--- id: wiki-2026-0508-apache-ignite title: Apache Ignite category: 10_Wiki/Topics status: verified canonical_id: self aliases: [Ignite, In-memory data grid, GridGain] duplicate_of: none source_trust_level: A confidence_score: 0.9 verification_status: applied tags: [in-memory, data-grid, distributed-cache, sql, compute-grid] raw_sources: [] last_reinforced: 2026-05-10 github_commit: pending tech_stack: language: java framework: Apache Ignite 2.16 --- # Apache Ignite ## 매 한 줄 > **"매 distributed in-memory data grid + compute grid + ANSI SQL"**. 매 GridGain (2007) → Apache Ignite (2014, donated). 매 2026 modern stack 은 Ignite 2.16 (GA mid-2025) / Ignite 3.x (preview, 매 new architecture: RAFT-based, ANSI SQL-first, 매 GridGain 9 commercial). 매 Hazelcast / Redis 의 alternative — 매 SQL + ACID transactions 의 differentiator. ## 매 핵심 ### 매 features - **In-memory key-value cache** — partitioned (sharded) or replicated. - **Distributed ANSI-99 SQL** — collocated joins, indexes, JDBC/ODBC. - **ACID transactions** — pessimistic / optimistic, distributed two-phase commit. - **Compute grid** — send code to data (Java/.NET/C++). - **Service grid** — deploy stateful services across cluster. - **Native persistence** — durable on-disk (since 2.1, 2017). - **Streaming** — continuous queries, data streamer. ### 매 architecture - **Topology**: server nodes + client/thin clients. - **Affinity**: rendezvous hashing, partition-to-node assignment. - **Backup**: synchronous/async backups per cache (RF=N). - **Discovery**: TcpDiscoverySpi (multicast / static / Kubernetes / ZooKeeper). - **Communication**: TcpCommunicationSpi. ### 매 응용 1. **Hot cache layer** — in front of Postgres/Oracle, sub-ms reads. 2. **Distributed SQL** — operational analytics across shards. 3. **Compute grid** — financial risk calc, ML feature scoring at data. 4. **Session storage** — JCache (JSR-107) compliant. ## 💻 패턴 ### Cache config (Java) ```java IgniteConfiguration cfg = new IgniteConfiguration(); CacheConfiguration cc = new CacheConfiguration<>("orders"); cc.setCacheMode(CacheMode.PARTITIONED); cc.setBackups(1); cc.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.PRIMARY_SYNC); cc.setIndexedTypes(Long.class, Order.class); cfg.setCacheConfiguration(cc); Ignite ignite = Ignition.start(cfg); IgniteCache orders = ignite.cache("orders"); orders.put(1L, new Order(...)); ``` ### Distributed SQL ```java SqlFieldsQuery q = new SqlFieldsQuery( "SELECT o.id, c.name FROM \"orders\".Order o " + "JOIN \"customers\".Customer c ON o.customerId = c.id " + "WHERE o.status = ?") .setArgs("paid"); try (var cur = orders.query(q)) { for (List row : cur) System.out.println(row); } ``` ### Affinity collocation (cross-cache JOIN performance) ```java @QuerySqlField(index = true) private Long customerId; // Affinity key — rows with same customerId on same node @AffinityKeyMapped private Long customerId; // Now JOIN orders ↔ customers stays node-local ``` ### Transaction (pessimistic, repeatable read) ```java try (Transaction tx = ignite.transactions().txStart( TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ)) { Account from = accounts.get(fromId); Account to = accounts.get(toId); if (from.balance < amount) throw new RuntimeException("INSUFFICIENT"); from.balance -= amount; to.balance += amount; accounts.put(fromId, from); accounts.put(toId, to); tx.commit(); } ``` ### Compute grid (broadcast) ```java ignite.compute().broadcast(() -> { System.out.println("Hello from " + ignite.cluster().localNode().id()); }); // Send Lambda — Ignite peer-class-loads to all nodes ``` ### Continuous query (CDC-like) ```java ContinuousQuery qry = new ContinuousQuery<>(); qry.setLocalListener(events -> { for (CacheEntryEvent e : events) System.out.println("Updated: " + e.getKey() + " → " + e.getValue()); }); qry.setRemoteFilterFactory(() -> e -> e.getValue().getStatus().equals("paid")); orders.query(qry); ``` ### Native persistence ```java DataStorageConfiguration ds = new DataStorageConfiguration(); ds.getDefaultDataRegionConfiguration().setPersistenceEnabled(true); ds.setStoragePath("/var/ignite/persistence"); cfg.setDataStorageConfiguration(ds); // Restart-safe; in-memory speed + durability ignite.cluster().state(ClusterState.ACTIVE); ``` ### Thin client (lightweight, no peer-class-loading) ```java ClientConfiguration cc = new ClientConfiguration().setAddresses("ignite:10800"); try (IgniteClient c = Ignition.startClient(cc)) { ClientCache orders = c.getOrCreateCache("orders"); orders.put(1L, new Order(...)); } ``` ## 매 결정 기준 | 상황 | Tool | |---|---| | Pure key-value cache, simple | Redis | | K-V + distributed events, JVM | Hazelcast | | K-V + ANSI SQL + ACID + compute grid | Ignite | | In-process cache | Caffeine | | Cloud-native managed | ElastiCache / Memorystore / GridGain Cloud | **기본값**: 매 Redis 매 simple cache, 매 Ignite 매 SQL+ACID+compute integrated, 매 Hazelcast 매 JVM-native event-driven. ## 🔗 Graph - 부모: [[In-Memory Data Grid]] · [[Distributed Cache]] - 변형: [[GridGain]] ## 🤖 LLM 활용 **언제**: 매 sub-ms latency + SQL + ACID 의 simultaneous requirement, 매 compute-near-data, 매 JVM ecosystem. **언제 X**: 매 simple cache only (Redis cheaper), 매 non-JVM stack (limited tooling), 매 small data (<10GB, single node fine). ## ❌ 안티패턴 - **No backups**: 매 node loss → data loss. 매 setBackups(≥1). - **Cross-cache JOIN without affinity**: 매 network shuffle, 매 query 의 slow. - **Synchronous replication everywhere**: 매 latency. 매 PRIMARY_SYNC + async backup balance. - **Mixing partitioned + replicated joins carelessly**: 매 broadcast amplification. ## 🧪 검증 / 중복 - Verified (Apache Ignite docs 2.16, GridGain documentation, ASF Ignite 3.x roadmap). - 신뢰도 A. ## 🕓 Changelog | 날짜 | 변경 | |---|---| | 2026-05-08 | Phase 1 | | 2026-05-10 | Manual cleanup — full content (Ignite cache, SQL, transactions, compute grid) |