Skip to content
Notifications
Clear all

Why does Xray take 5x longer to scan a container than Clair?

3 Posts
3 Users
0 Reactions
1 Views
(@devops_rookie_2025)
Reputable Member
Joined: 2 months ago
Posts: 203
Topic starter   [#13457]

Hey everyone, total newcomer here trying to understand the scanning landscape. 😊

I was running some tests in our CI pipeline, scanning the same container image with both JFrog Xray and Clair. I'm seeing Xray take consistently around 5 minutes, while Clair finishes in under a minute for the same image. Both are configured with their default policies for critical/high CVEs.

My simple setup was:
```bash
# Trivy (using Clair engine) for comparison
trivy image --severity CRITICAL,HIGH myimage:latest
```
vs. triggering an Xray scan through the JFrog CLI.

Could someone explain in beginner-friendly terms why there's such a big speed difference? Is Xray doing deeper analysis, or is it about how it fetches vulnerability data? Any insights on what I'm paying for with that extra time would be super helpful!



   
Quote
(@johnm)
Trusted Member
Joined: 1 week ago
Posts: 36
 

Ah, the classic "what am I paying for" question. You're comparing a free, open-source tool with a commercial product, and the speed difference is just the most obvious symptom.

Your test isn't quite apples-to-apples. Trivy with Clair's engine is a straightforward vulnerability matcher, full stop. Xray is, to hear JFrog tell it, a "software composition analysis" platform. That means it's not just checking a CVE database, it's also building a bill of materials for all dependencies, checking licenses, and probably indexing the artifact for its own catalog. All that overhead happens before it even tells you about the first vulnerability.

Whether that's "deeper analysis" or just vendor bloat depends on whether you actually need license compliance or a perpetual audit trail. If you just need to know if your container is broken, you might be paying for four minutes of features you'll never use.


Just my 2 cents


   
ReplyQuote
(@jasonh)
Estimable Member
Joined: 1 week ago
Posts: 97
 

You've got a good point about the different scopes making it an uneven comparison. That overhead you mentioned for building the bill of materials and license checking is definitely a factor, but I think there's another, more operational reason for the lag.

From my own use, a big part of those five minutes isn't just analysis time, it's queue time. Our Xray setup shares a resource pool across the whole platform, so scans wait in line. A standalone Clair/Trivy scanner in a pipeline is usually a dedicated process for that job. So the "cost" you pay in time isn't always for deeper features, sometimes it's for the convenience of a centralized service that doesn't scale down to zero.

It makes the speed test really dependent on your environment size. In a busy Artifactory instance, that five minutes could be three minutes of waiting.


~jason


   
ReplyQuote