Sub topic 15
Memory and database storage, large sites and crawling behind a login
This chapter covers how the SEO Spider stores crawl data, how to size a crawl for a large site, and how to crawl pages that need a login. It assumes you have run a first crawl, can scope a crawl with include and exclude rules, and know how to read the Internal tab. You also need permission to crawl the site, and for authenticated crawls you need an account that is meant for this purpose.
Two storage modes
The SEO Spider keeps crawl data in one of two places. You choose the mode under File > Settings > Storage Mode (called Configuration > System > Storage Mode in some versions).
- Memory storage keeps the whole crawl in RAM. It is fast, but the number of URLs you can crawl is limited by the memory you give the tool.
- Database storage writes crawl data to disk as it goes. It is slower than memory mode on a spinning disk, but it handles far more URLs and keeps the crawl if the application closes unexpectedly.
| Aspect | Memory storage | Database storage |
|---|---|---|
| Where data lives | RAM | Disk (an embedded database) |
| Typical use | Small and mid-sized sites | Large sites, or machines with limited RAM |
| Crawl saving | Manual save, and large crawls take time to write | Crawls are stored automatically and can be reopened from File > Crawls |
| Disk requirements | Low | Needs plenty of free space, ideally on an SSD |
| Risk | A crash or out-of-memory error can lose the crawl | Slower on a hard disk drive |
Database storage is the usual recommendation when you have a solid-state drive. On a machine with a spinning hard disk, memory storage with extra RAM can be faster.
A storage mode change usually needs a restart of the application. Check the current setting before a long crawl, not after it fails.
Allocating memory
In memory mode, the limit is the RAM allocation. In database mode, the allocation still matters, because the tool needs working memory for processing, rendering and exports.
You set the allocation under File > Settings > Memory Allocation (or Configuration > System > Memory). Enter a value in gigabytes and restart the tool.
Some practical rules:
- Leave at least 2 GB of RAM free for the operating system and other programs. Allocating all of your RAM makes the machine swap and slows everything down.
- Raise the allocation before a crawl, not during it.
- A 64-bit operating system is needed to allocate more than a few gigabytes.
- JavaScript rendering, many extraction rules and API data all increase memory use per URL.
If the SEO Spider shows a low-memory warning, it pauses the crawl so you can save the data and raise the allocation. Take the warning seriously. Continuing with very little free memory risks a crash.
Estimating the size of a crawl
Before you crawl a large site, estimate how many URLs you will meet. Useful sources are:
- The XML sitemap URL count.
- The page count reported by Search Console's indexing reports.
- A site: search in a search engine, which is only a rough guide.
- Your CMS or database record count.
Crawl size is often bigger than any of these, because the crawler also finds images, CSS, JavaScript files, parameter URLs, paginated URLs and redirects. Plan for the crawl to be several times larger than your page count if you leave resources on.
Reducing the load of a large crawl
You do not have to crawl everything to learn what you need. These choices cut memory, disk and time.
- Turn off resource types you do not need. Under Configuration > Spider > Crawl, untick Images, CSS, JavaScript, SWF or Media if you are only auditing HTML pages. Fewer resource URLs means fewer rows.
- Exclude noise with rules. Use the Exclude rule from the scoping chapter to skip parameter URLs, for example:
.*\?sessionid=.*- Limit the crawl depth or the number of URLs. Configuration > Spider > Limits holds Limit Crawl Total, Limit Crawl Depth, Limit Max Folder Depth and Limit Number of Query Strings.
- Crawl a section at a time. Start the crawl at a subfolder and enable Crawl Outside of Start Folder only if you need it. Splitting a large site into sections gives you smaller, faster crawls that are easier to read.
- Disable features you are not using now. Custom extraction, spelling and grammar checks, and JavaScript rendering all add cost. Turn them on for a targeted second crawl.
- Use a crawl speed that your server tolerates. Under Configuration > Speed, set the maximum threads and the maximum URLs per second. See the warning below.
Saving and reopening large crawls
In database mode, each crawl is stored automatically. You can reopen one from File > Crawls, where you can also rename, export or delete crawls to recover disk space. In memory mode, use File > Save to write a crawl file, and expect a large crawl to take a while to save and reload.
The crawl database lives in a folder on your machine. If your system drive is small, move the database location to a larger drive in the storage settings, and keep it on an SSD if you can. Delete old crawls you no longer need. A large crawl can take several gigabytes.
Pausing, resuming and exporting
You can pause a crawl and resume it later. In database mode, a crawl can usually be reopened and resumed after you close the application. This is useful for very large sites that take hours to crawl.
For large result sets, avoid exporting everything at once. Use the bulk export menu or the tab-level Export button for the specific issues you are fixing. Smaller exports open faster in a spreadsheet, which has its own row limit. If a CSV is too large for a spreadsheet, process it with a script, as the command-line chapter shows.
Crawling behind a login
Pages behind a login are not reachable by a default crawl. The SEO Spider supports several ways to authenticate. They are under Configuration > Authentication.
Standards-based authentication
Basic and digest authentication are the browser pop-up kind. When the crawler meets a 401 response with such a challenge, it prompts for a username and password, and it then sends those credentials with later requests to that host. This is common on staging sites.
Forms-based authentication
Forms-based authentication opens a built-in browser so you can log in to the site yourself. The SEO Spider stores the resulting session cookies and uses them for the crawl.
- Open Configuration > Authentication > Forms Based.
- Click Add, enter the login page URL, and the built-in browser loads it.
- Log in as you normally would, including any two-step prompt, then confirm.
- Start the crawl from a URL inside the logged-in area.
Forms-based authentication relies on the JavaScript rendering browser, so it uses more resources, and it does not suit sites that use CAPTCHAs.
Common authentication problems
- The crawler logs itself out. Links such as /logout can end the session. Exclude them before you start, for example with an Exclude rule matching the logout path.
- The session expires. Long crawls can outlast a session timeout. Crawl in sections, or ask for a longer session for the test account.
- Some content changes by role. The crawl only sees what the account sees, so crawl with a role that matches the audit goal.
- Credentials are stored in your configuration. Do not share saved configuration files or crawl files that contain them.
Checking that a login crawl worked
After the first few hundred URLs, check three things in the Internal tab. First, the Status Code column should show 200 for logged-in pages, not 302 redirects to a login URL. Second, filter by Address for the login path and confirm that few pages point to it. Third, open a crawled page in the View Source or Rendered Page lower tab and confirm it shows member content, not the login form.
If many pages redirect to the login URL, the session is not being applied. Stop the crawl, repeat the authentication, and restart.
Choosing a setup
The threshold in the first decision depends on your hardware. Treat it as a starting point, then adjust after you see how your machine handles a trial crawl.
Common mistakes
- Running a large crawl in memory mode with the default allocation, then losing it to an out-of-memory error.
- Allocating nearly all system RAM, which makes the machine unresponsive.
- Leaving images, CSS and JavaScript on for an audit that only needs HTML.
- Forgetting to exclude logout and action URLs in an authenticated crawl.
- Letting the crawl database fill the system drive.
- Crawling at full speed on shared hosting.
Exercise
You need to audit a 600,000-page site on a laptop with 16 GB of RAM and an SSD. The part of the site you care about is behind a member login. Describe the storage mode, memory setting, scope choices and authentication steps you would use, and one check to confirm the login worked.
Show answer
Use database storage, since the site is large and the laptop has an SSD. Set the memory allocation to roughly 8 GB, which leaves plenty for the operating system. Untick images, CSS and JavaScript if the audit is about HTML pages, add Exclude rules for parameter URLs and for logout and action URLs, and crawl one section at a time with a crawl limit. Set up forms-based authentication with a low-permission test account, start the crawl inside the member area at a low URL rate, and raise the speed only if response times stay stable. To confirm the login worked, check the Internal tab: pages should return 200, not 302 redirects to the login URL, and the Rendered Page view should show member content.