serpapi-performance-tuning

Featured

Optimize SerpApi performance with caching, async searches, and result filtering. Use when reducing latency, minimizing credit consumption, or optimizing search throughput. Trigger: "serpapi performance", "optimize serpapi", "serpapi caching", "serpapi slow".

AI & Automation 2,274 stars 319 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# SerpApi Performance Tuning ## Overview SerpApi typical latency: 2-5 seconds per search (real-time scraping). Main optimization: aggressive caching since search results change slowly. Secondary: use Google Light API for faster responses, reduce `num` parameter, and parallelize independent searches. ## Instructions ### Step 1: Multi-Layer Caching ```typescript import { LRUCache } from 'lru-cache'; import { Redis } from 'ioredis'; import { getJson } from 'serpapi'; // L1: In-memory (fastest, per-instance) const l1 = new LRUCache<string, any>({ max: 1000, ttl: 600_000 }); // 10 min // L2: Redis (shared across instances) const redis = new Redis(process.env.REDIS_URL!); async function cachedSearch(params: Record<string, any>): Promise<any> { const key = `serpapi:${JSON.stringify(params)}`; // L1 check const l1Hit = l1.get(key); if (l1Hit) return l1Hit; // L2 check const l2Hit = await redis.get(key); if (l2Hit) { const parsed = JSON.parse(l2Hit); l1.set(key, parsed); return parsed; } // Cache miss: real API call const result = await getJson({ ...params, api_key: process.env.SERPAPI_API_KEY }); l1.set(key, result); await redis.setex(key, 3600, JSON.stringify(result)); // 1 hour in Redis return result; } ``` ### Step 2: Google Light API (Faster) ```python # Google Light API: ~1s instead of 2-5s, limited result fields result = client.search(engine="google_light", q="fast query", num=5) # Returns: organic_results with title, link, sni...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
7 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Featured

serpapi-cost-tuning

Optimize SerpApi costs by reducing credit consumption and choosing the right plan. Use when analyzing search usage, reducing monthly costs, or implementing credit-saving strategies. Trigger: "serpapi cost", "serpapi pricing", "reduce serpapi costs", "serpapi credits".

2,274 Updated today
jeremylongshore
AI & Automation Featured

serpapi-sdk-patterns

Production-ready SerpApi client patterns with caching, typing, and multi-engine support. Use when building search services, implementing result caching, or wrapping SerpApi with typed responses. Trigger: "serpapi patterns", "serpapi best practices", "serpapi client wrapper".

2,274 Updated today
jeremylongshore
AI & Automation Featured

serpapi-reference-architecture

Production architecture for SerpApi search services with caching, monitoring, and multi-engine support. Use when designing search features, building SERP tracking systems, or architecting search-powered applications. Trigger: "serpapi architecture", "serpapi project structure", "serpapi design".

2,274 Updated today
jeremylongshore
AI & Automation Featured

serpapi-hello-world

Run your first SerpApi search -- Google, Bing, or YouTube results as JSON. Use when starting with SerpApi, testing search queries, or learning the structured result format. Trigger: "serpapi hello world", "serpapi example", "serpapi first search".

2,274 Updated today
jeremylongshore
AI & Automation Featured

serpapi-security-basics

Secure SerpApi API keys and prevent credit abuse. Use when storing API keys, implementing backend proxies, or auditing SerpApi access patterns. Trigger: "serpapi security", "serpapi API key security", "secure serpapi".

2,274 Updated today
jeremylongshore