[ 
https://issues.apache.org/jira/browse/IVY-973?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12649483#action_12649483
 ] 

Maarten Coene commented on IVY-973:
-----------------------------------

I think your patch will only work if you don't have a [revision] token in your 
directory structure.
Can you confirm this is the case in your situation?

So if your pattern looks like for instance 
"[organisation]/[module]/[revision]/[artifact]-[revision].[ext]", you'll still 
have a roundtrip for each revision.

I think we should try to avoid calling Resource.exists() in the 
ResolverHelper.findAll() method.

> [PATCH] SFTP repositories become very slow after a while
> --------------------------------------------------------
>
>                 Key: IVY-973
>                 URL: https://issues.apache.org/jira/browse/IVY-973
>             Project: Ivy
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 2.0-RC2
>            Reporter: Johannes Rudolph
>            Priority: Minor
>         Attachments: faster-sftp.patch
>
>
> If many versions of a module live in a folder of an SFTP repository each 
> resolve for dynamic versions becomes dreadfully slow because a roundtrip to 
> the server is made to the server for every version which lies on the server. 
> The call sequence goes like that:
> org.apache.ivy.plugins.resolver.util.ResolverHelper.findAll calls
>   1.  org.apache.ivy.plugins.resolver.util.ResolverHelper.listTokenValues 
> which calls
>         SFTPRepository.list with the directory of the module as parameter (1. 
> roundtrip)
>   2. for every found file matching the pattern 
> SFTPRepository.getResource(path).exists()
>         In turn SFTPResource tries to initialize itself and calls 
> SFTPRepository.resolveResource which does the second roundtrip to the server 
> - for every version of the file
> Example: Having 20 versions of a module in a repository which is a roundtrip 
> of 150ms away, leads to a lag of 20 * 150ms = 3s . Multiply that with any 
> module having a dynamic version.
> The solution is to cache all the resources in SFTPRepository. You can use the 
> information retrieved when calling SFTPRepository.list to fill the cache in 
> advance.
> The disadvantage is that you may have stale data. IMO this is mostly no 
> problem because every call to list updates the cache and files already 
> available in the repository won't hopefully change any metadata in the time 
> between.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to