glean-performance-tuning
Optimize Glean search relevance and indexing throughput with batch sizing, datasource configuration, and content quality improvements. Trigger: "glean performance", "glean search quality", "glean indexing speed".
Best use case
glean-performance-tuning is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Optimize Glean search relevance and indexing throughput with batch sizing, datasource configuration, and content quality improvements. Trigger: "glean performance", "glean search quality", "glean indexing speed".
Teams using glean-performance-tuning should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/glean-performance-tuning/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How glean-performance-tuning Compares
| Feature / Agent | glean-performance-tuning | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Optimize Glean search relevance and indexing throughput with batch sizing, datasource configuration, and content quality improvements. Trigger: "glean performance", "glean search quality", "glean indexing speed".
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
ChatGPT vs Claude for Agent Skills
Compare ChatGPT and Claude for AI agent skills across coding, writing, research, and reusable workflow execution.
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
SKILL.md Source
# Glean Performance Tuning
## Overview
Glean's enterprise search API handles search queries across multiple connectors, bulk document indexing, and connector sync throughput. Search latency compounds when querying across dozens of datasources simultaneously. Large indexing jobs (10K+ documents) require careful batching to avoid rate limits and maintain connector sync schedules. Optimizing batch sizes, caching frequent search results, and tuning connector configurations reduces search P95 latency and keeps indexing pipelines within SLA windows.
## Caching Strategy
```typescript
const cache = new Map<string, { data: any; expiry: number }>();
const TTL = { search: 60_000, suggestions: 30_000, datasources: 600_000 };
async function cached(key: string, ttlKey: keyof typeof TTL, fn: () => Promise<any>) {
const entry = cache.get(key);
if (entry && entry.expiry > Date.now()) return entry.data;
const data = await fn();
cache.set(key, { data, expiry: Date.now() + TTL[ttlKey] });
return data;
}
// Search results expire fast (1 min). Datasource metadata is stable (10 min).
```
## Batch Operations
```typescript
import PQueue from 'p-queue';
const BATCH_SIZE = 100;
async function indexDocsBatched(glean: any, dsName: string, docs: any[]) {
const batches = [];
for (let i = 0; i < docs.length; i += BATCH_SIZE) batches.push(docs.slice(i, i + BATCH_SIZE));
const queue = new PQueue({ concurrency: 3, interval: 500 });
await Promise.all(batches.map(batch =>
queue.add(() => glean.indexDocuments(dsName, batch))
));
}
```
## Connection Pooling
```typescript
import { Agent } from 'https';
const agent = new Agent({ keepAlive: true, maxSockets: 15, maxFreeSockets: 5, timeout: 30_000 });
// High socket count for parallel indexing across multiple datasources
```
## Rate Limit Management
```typescript
async function withGleanRateLimit(fn: () => Promise<any>): Promise<any> {
try { return await fn(); }
catch (err: any) {
if (err.status === 429) {
const retryMs = parseInt(err.headers?.['retry-after'] || '5') * 1000;
await new Promise(r => setTimeout(r, retryMs));
return fn();
}
throw err;
}
}
```
## Monitoring
```typescript
const metrics = { searches: 0, indexOps: 0, cacheHits: 0, p95LatencyMs: 0, errors: 0 };
const latencies: number[] = [];
function trackSearch(startMs: number, cached: boolean) {
const lat = Date.now() - startMs; latencies.push(lat); metrics.searches++;
if (cached) metrics.cacheHits++;
latencies.sort((a, b) => a - b);
metrics.p95LatencyMs = latencies[Math.floor(latencies.length * 0.95)] || 0;
}
```
## Performance Checklist
- [ ] Batch indexing calls at 100 docs per request with 3 concurrent workers
- [ ] Use incremental indexing for real-time updates (< 100 docs)
- [ ] Switch to bulkindexdocuments for daily full refreshes (> 1K docs)
- [ ] Cache repeated search queries with 1-min TTL
- [ ] Set descriptive document titles and full body text for relevance
- [ ] Keep connector sync schedules staggered to avoid burst load
- [ ] Monitor P95 search latency and indexing throughput
- [ ] Enable keep-alive connections with high socket count for parallel ops
## Error Handling
| Issue | Cause | Fix |
|-------|-------|-----|
| Slow cross-datasource search | Too many connectors queried in parallel | Prioritize datasources, set query scope |
| 429 on bulk indexing | Batch size or concurrency too high | Reduce to 100/batch, 3 concurrent, 500ms interval |
| Stale search results | Index lag after document updates | Use incremental indexing with webhooks on change |
| Connector sync timeout | Large datasource with no checkpointing | Enable incremental sync with cursor tracking |
| Missing documents in results | Incomplete metadata during indexing | Include title, body, author, and updated_at fields |
## Resources
- [Glean Developer Portal](https://developers.glean.com/)
- [Glean Indexing API Guide](https://developers.glean.com/docs/indexing)
## Next Steps
See `glean-reference-architecture`.Related Skills
running-performance-tests
Execute load testing, stress testing, and performance benchmarking. Use when performing specialized testing. Trigger with phrases like "run load tests", "test performance", or "benchmark the system".
workhuman-performance-tuning
Workhuman performance tuning for employee recognition and rewards API. Use when integrating Workhuman Social Recognition, or building recognition workflows with HRIS systems. Trigger: "workhuman performance tuning".
workhuman-cost-tuning
Workhuman cost tuning for employee recognition and rewards API. Use when integrating Workhuman Social Recognition, or building recognition workflows with HRIS systems. Trigger: "workhuman cost tuning".
wispr-performance-tuning
Wispr Flow performance tuning for voice-to-text API integration. Use when integrating Wispr Flow dictation, WebSocket streaming, or building voice-powered applications. Trigger: "wispr performance tuning".
wispr-cost-tuning
Wispr Flow cost tuning for voice-to-text API integration. Use when integrating Wispr Flow dictation, WebSocket streaming, or building voice-powered applications. Trigger: "wispr cost tuning".
windsurf-performance-tuning
Optimize Windsurf IDE performance: indexing speed, Cascade responsiveness, and memory usage. Use when Windsurf is slow, indexing takes too long, Cascade times out, or the IDE uses too much memory. Trigger with phrases like "windsurf slow", "windsurf performance", "optimize windsurf", "windsurf memory", "cascade slow", "indexing slow".
windsurf-cost-tuning
Optimize Windsurf licensing costs through seat management, tier selection, and credit monitoring. Use when analyzing Windsurf billing, reducing per-seat costs, or implementing usage monitoring and budget controls. Trigger with phrases like "windsurf cost", "windsurf billing", "reduce windsurf costs", "windsurf pricing", "windsurf budget".
webflow-performance-tuning
Optimize Webflow API performance with response caching, bulk endpoint batching, CDN-cached live item reads, pagination optimization, and connection pooling. Use when experiencing slow API responses or optimizing request throughput. Trigger with phrases like "webflow performance", "optimize webflow", "webflow latency", "webflow caching", "webflow slow", "webflow batch".
webflow-cost-tuning
Optimize Webflow costs through plan selection, CDN read optimization, bulk endpoint usage, and API usage monitoring with budget alerts. Use when analyzing Webflow billing, reducing API costs, or implementing usage monitoring for Webflow integrations. Trigger with phrases like "webflow cost", "webflow billing", "reduce webflow costs", "webflow pricing", "webflow budget".
vercel-performance-tuning
Optimize Vercel deployment performance with caching, bundle optimization, and cold start reduction. Use when experiencing slow page loads, optimizing Core Web Vitals, or reducing serverless function cold start times. Trigger with phrases like "vercel performance", "optimize vercel", "vercel latency", "vercel caching", "vercel slow", "vercel cold start".
vercel-cost-tuning
Optimize Vercel costs through plan selection, function efficiency, and usage monitoring. Use when analyzing Vercel billing, reducing function execution costs, or implementing spend management and budget alerts. Trigger with phrases like "vercel cost", "vercel billing", "reduce vercel costs", "vercel pricing", "vercel expensive", "vercel budget".
veeva-performance-tuning
Veeva Vault performance tuning for REST API and clinical operations. Use when working with Veeva Vault document management and CRM. Trigger: "veeva performance tuning".