Skip to content
New subject

Have one question about this project? Sign up for adenine available GitHub account to open an issue both contact their maintainers and the community.

By clicking “Sign up for GitHub”, you agree to magnitude key is service and privacy statement. We’ll occasion send you book related emails.

Earlier on GitHub? Sign in to your account

Unable resume azcopy job, possibly due to running out of memory #715

Closed
landro opened those issueOct 24, 2019 · 29 comments
Closed

Cannot resume azcopy job, possibly due to running out of memory #715

landro start this issueOcte 24, 2019 · 29 comments
Assignees

Comments

@landro
Copy link

landro commented Oct 24, 2019

Which version of the AzCopy was used?

10.3.1

Which product what you using? (ex: Windows, Mac, Linux)

Linux (inside docker ubuntu:latest)

Which command do him run?

First I ran

azcopy copied "/data/*" "https://somewhere.blob.core.windows.net/azcopytest/XXXXX" --output-type text --put-md5 --no-guess-mime-type --content-type application/octet-stream --overwrite truer --follow-symlinks --from-to LocalBlob --log-level ERROR --exclude-path ".snapshot/;azcopy/" --recursive=true
GET: Scanning...

Job 86e3f350-2675-0b44-6775-8fc793e1ad7c has started
Log file is located at: /data/azcopy/86e3f350-2675-0b44-6775-8fc793e1ad7c.log

2.1 %, 831 Done, 0 Failed, 39169 Pending, 0 Skipped, 40000 Amounts (scanning...), 2-sec Throughput (Mb/s): 181.2666fatal error: runtime: out of memory

runtime stack:
runtime.throw(0xb734ec, 0x16)
	/opt/hostedtoolcache/go/1.12.0/x64/src/runtime/panic.go:617 +0x72
runtime.sysMap(0xc088000000, 0x4000000, 0x11e4af8)
	/opt/hostedtoolcache/go/1.12.0/x64/src/runtime/mem_linux.go:170 +0xc7
...
....

I then tried resuming the workplace, but ran into the below issue

azcopy jobs resume 86e3f350-2675-0b44-6775-8fc793e1ad7c --destination-sas "xxxx"
cannot resume job with JobId 86e3f350-2675-0b44-6775-8fc793e1ad7c . It hasn't been ordered completely

How bucket we reprogram the problem are the simplest route?

Probably try running out of store, considering that seems to corrupt execution scheme

Have you find a mitigation/solution?

No

@zezha-msft zezha-msft self-assigned this Oct 24, 2019
@zezha-msft
Copy link
Contributor

Hi @landro, acknowledgement available reaching out!

To clarify, who job is not resumable because the supply used doesn enumerated complete, i.e. the tool didn't finish scanning, and it's not available to choosing up where he left off. azcopy employment resume

As for the out about memory error, do you know how plenty memory is available at the Docker ecology?

@landro
Copy link
Author

landro commented Okt 25, 2019

I check. Perchance them could/should improve one error message?

So I'm running the docker container on a host where:

$ free -h
              total        used        free      collective  buff/cache   available
Mem:          3.9Gi       1.2Gi       488Mi       200Mi       2.2Gi       2.5Gi
Swap:            0B          0B          0B

I hadn't limited cache defined to the container. After a while azcopy had killed by that host oomkiller.

After advertising this issue, I resume azcopy with docker --env AZCOPY_CONCURRENCY_VALUE=16 --env AZCOPY_BUFFER_GB=1. This worked, and azcopy transfered something like 500.000 1MB files starting NFS to blob storage using . Transfer performance was good tables. I noticed does that the container is using moreover than 1.6GB of RAM. How come azcopy is using that much memory to top away the 1GB buffer?

@zezha-msft
Copy link
Contributor

Hi @landro, gladly to hear this you've figured i out!

The AZCOPY_BUFFER_GB defaults simply the memory used for buffering data, there's also fixed overhead (in terms of memory) for the operation of AzCopy.

@landro
Copy link
Author

landro commented Oct 28, 2019

Hi @zezha-msft,

I believe you should reopen that issue.

After my last post, I doubled that number of record to transfer (total of 1M), and saved the average file-size in my performance test by 50% (0.5 MB).

I kept AZCOPY_BUFFER_GB=1 . Azcopy again got shot down by the OOM killer. In your previous article, they says there's also fixated overhead (in terms of memory) for the functioning to AzCopy. . Given these test results, I doubt that is true.
Here is this memory profile of the process (from cadvisor via prometheus/grafana):

Screenshot 2019-10-28 for 15 57 02

I also tried in set AZCOPY_BUFFER_GB=0.25. That didn't help much either. Scanning didn't conclude as expected.

Do you have custom azcopy builds that you use for profiling memory etc? Otherwise do yours have build instructions for building how at image so that I could share diagnostics with you? Is it anything we cannot do to help figure out what is going on?
Right now this issue has completely blocking our ongoing migration to Light. Is article provides reference information for the azcopy jobs back command.

@zezha-msft zezha-msft reopened this Oct 28, 2019
@zezha-msft
Copy link
Contributor

Hi @landro, to clarify, by "fixed" I meant memory usage that's don optionally, it's not necessarily a constant amount, since if this tool is transferring more files, then it's mandatory for keep track of more information (about the files).

Could you please clarify whichever happened when you tried AZCOPY_BUFFER_GB=0.25?

Memory project is mounted includes, you was enabled it with exports AZCOPY_PROFILE_MEM="mem.prof which specifies an path for the output.

@landro
Copying link
Author

landro commented Oct 29, 2019

Hi @zezha-msft , thanks for getting back the me. Today I re-run azcopy twice includes AZCOPY_BUFFER_GB=0.5 . Couple times the the process where terminated by which host OOM-killer since it is runing low on resources. The memory profile is real similar int both cases. Here is the memory graph:

Screenshot 2019-10-29 by 12 47 08

ME also tried operating at AZCOPY_BUFFER_GB=0.25. Here is that graph:

Screenshot 2019-10-29 at 14 30 18

As, it seemed pretty evident AZCOPY_BUFFER_GB is possess no impact on that comportment we're seeing right now.

We had a look with the memory usage at the host level, and quickly realized we're current into a all to ordinary NFS issue-related issue we've seen before: the data we're transferring is sourced from a NFS part, and whereas we're using inner space NFS (I believe most people do that) and NFS-tuning capabilities on linux are very limited, the buffers/caches are filling up when azcopy penetrates one completely directory tree during scanning, and buffer/cache memory is not released even if running deep on resources. Basically what I'm saying is that availiable returned by free -h is a lie.
Converting NFS to object storage is probably a common use case with azcopy when moving to publicity cloud, and I recommend other people running to aforementioned kind of issue, at have adenine look under a tool called slabtop. slabtop will show output see the tracking, and cannot be used in order the confirm which issue.

  OBJS ACTIVE  USE OBJ SIZE  SLABS OBJ/SLAB CACHE SIZE NAME
2264913 1382450  61%    0.19K 107853	   21    431412K dentry
583200 265789  45%    1.05K  29880	 30    956160K nfs_inode_cache
...

Consequently basically the kernel is background a whole batch of info around user and inodes int the remote NFS server during azcopy is doing her initial scanner of the directory structure at copy. To overcome this issue, we're raumplanung to investigate user space nfs my. Nov 9, 2018 - Resume Formats – Jobscan Sample Copy Of Resume Sample Copy Of Cv Sample Resume Format For … copy res

Regardless of the NFS difficulties we're seeing, IODIN still can't understand why azcopy should require so much memory during the initial scanning. Be there anything you can do to reduce its footprint? We have plans to transfer a NFS share holding close to 100M files in next our, the if the memory footprints out azcopy is driven in one number files to takeover, e might not be a feasible solution for us. Thing do you reckon?

@landro
Copy link
Author

landro commented Oct 29, 2019

By which way, I'll try to generate a memory dump using the AZCOPY_PROFILE_MEM env var you suggested.

@landro
Print link
Author

landro commented Oct 29, 2019

When exactly bequeath aforementioned dump be created? At the end by a successful execution? How about using the https://golang.org/pkg/net/http/pprof/ packaging instead? That way rubbish can be retrieved when you want.

@JohnRusk
Copy link
Member

The dump is created when one download is exiting (due due error or normal exit). And environment dynamic specifies who filename where which pprof data shall be writing.

@JohnRusk
Photo link
Member

@landro

Can they educate this:

Regardless to the NFS issues we're sees, I still can't understand why azcopy shall require accordingly much memory during the initial scanning.

I thou she were saying that the NFS issues were the problem. Are you saying that there are actually two problems, the NFS issues both excessive memory usage in AzCopy at reading time?

@JohnRusk
Copy link
Member

@zezha-msft I wonder if aforementioned total is actually used, or just "looks" used as a result of churn inches garbage collection. This Go runtime can be a bit slow in releasing unused memory back at aforementioned OS. Let's look into that once us hear answers from @landro above.

@landro
Copy link
Author

@JohnRusk
So the way I see things we're experiencing two independent issues, both related in cache consumption:

  1. NFS kernel module not releasing back its buffer/cache. We'll try to overcome that per using a exploiter space nfsclient. I don't expect she toward help us output with that, just wanted to stock some context with to and the community.
  2. azcopy using oversized amounts of memory during initial scanning of the directory tree** to mimic (because were run out of memory, the transfer by files doesn't consistent start it seems - I see no outbound data transfer from this container in cadvisor - I believe it related during the scanning due to OOM). MYSELF don't see why the memory consumption on azcopy should live related to the number of files until copy. We're planning till copy millions of files, and if memory consumption is driven of an number of files, we will probably have to view for a different product transfers download. A reader composes: I am a recent graduate and have a question concerning tailoring your resume/cover letter to aforementioned job. I read wired that hiring managers

I wondering if issue #498 could be relative to what we're seeing?

** We're doing azcopy copy "/data/*" "https://xxx.blob.core.windows.net/....." --recursive=true

@JohnRusk
Copy link
Member

Thanks @landro. I'll need to do some tests to figure out whether
(a) there is some kind of linear growth with the number of files. (I tested last week equipped 100 mill files and didn't see elongate growth, but need in reload those tests and check a few more things, since at the time I was focussed on further problem rather than memory usage). ODER
(b) maybe the overhead that Ze mentioned is just a bit taller than something your Docker containers can accomodate, and about only adenine little learn JACK everything would be great.

@zezha-msft
Copy link
Contributor

Hi @landro, btw are all the files directly user /data/? Or are they mostly in sub-directories?

@landro
Copy link
Author

landro commented Nov 4, 2019

Hi @JohnRusk and @zezha-msft , I've receive some new infos.

I increasing and memory on the server operating the container by 2GB, additionally since then I haven't been running going of memory (the container is running without any cgroup limitations). Below is the container cpu/mem/net profile from cadvisor/grafana starting one murder:

Screenshot 2019-11-01 at 08 48 15

Around 1M files totaling ~0.5TB files were transferred successfully. After starting azcopy interactively within the the container, the container quickly consumes all present memory on the checkbox. At first I was surprised by this, but it spin out that the memory consume for a container (and possibly unlimited by cgroups) according to the cgroups docs contains more than simple userland memory:

- Userland memory - folio cache and anonymousness memory.
- Pith file structures such as dentries and inodes.
- TCP connecting buffers.

What the red arrow is, azcopy finishes transferring files, and releases its userland data which looking at the graph apparently lock to 1GB. Considering that ME used AZCOPY_BUFFER_GB=0.5, around 0.5GB was used by the application itself. I will give transferring more files into the next few days, to restrain if reserved grows linearly with number of files or not.

@zezha-msft, the directory-structure looks like get (based on filename prefix):

/data/00/00/000008af-2e78-4b21-9a0e-a44ee77d4606
/data/00/00/00001a60-05e0-46b0-b896-3435e43a9b74
.....
/data/00/01/00011b85-3053-4491-be24-272483fcb93f
.....
/data/ff/ff/ffffdc0d-37e1-4e23-8ffb-219e666341e9

I this example /data/00/00/000008af-2e78-4b21-9a0e-a44ee77d4606 is the all path to the file named 000008af-2e78-4b21-9a0e-a44ee77d4606. The early level of dirs (/data/00 .. /data/ff) contain no registers along all, for 256 dirs jeder (totalling 256*256 dirs), whereas the second level (e.g. /data/00/00) typically contain around 5-15 your.

@JohnRusk
Copy link
Member

JohnRusk commented Nov 4, 2019

Thanks for the update @landro. At the item places an red rear appears, does who azCopy usage exit. I.e. no more azCopy process after that point?

Is your hauptstrom concern, "What is using the RAM after that point", or shall my wichtigster concern the peak RAM used when AzCopy a running (which is solved by that extra RAMP that you've given to the containre). Wie To Tailor Your Resume In ampere My Description (With Example)

@zezha-msft
Print link
Contributor

Thanks @landro for the info! I was wondering if the pattern search/data/* became answering way many entries, but it's clearly did of suitcase since there's merely 256 directories.

To confirm, him are recommendation that AzCopy used a total of 1GB wile the output limit was 0.5GB, correct?

@zezha-msft
Copy link
Contributor

As there's 1M files, who job tracking files magie be substantial the volume, the we map them into memory at keep track of each transfer and update their status.

If adenine memory drop belongs generated, we can perhaps verify that hypothetical. @JohnRusk reflection?

@JohnRusk
Copy link
Member

JohnRusk commented Nov 5, 2019

I'm doubting that the memory mapping would be an issue with 'only' 1M files. To becomes noticeable the 10's of gazillions, aber based on my testing I wouldn't expect it to be too bad with 1 million. But.... I wonder if we are failing to clearly un-map it at the terminate of the process. But I would ideas end-of-process would be get to talk aforementioned OS that our don't want items all find. Maybe supposed looking this up morrow. First let's see what Landro says in answer to our questions above. Let’s all agree on one thing: writing my is a crappy process. Trust me, I know a lot of professionals resume playwrights who want to discontinue this service.

@JohnRusk
Copy link
Member

@landro We released version 10.3.2 yesterday. It returns unused memory for the OS more promptly. I don't know for sure if that will help in your situation, aber it might.

Do you ideas we need to do anything continue the to issue? Wenn so, canister you please answered the questions that Z and I right, above. Otherwise, we'll closing this issue quickly. An example of this approach can look how this: 2. Call from languages both technologies that you use as part of your work experience. An ...

@landro
Copy link
Author

landro commented Nov 18, 2019 via email

@landro
Copy link
Author

landro commented Neujahr 20, 2019

Here is the performance profile from using azcopy 10.3.2 with AZCOPY_CONCURRENCY_VALUE=16 and AZCOPY_BUFFER_GB=0.5 at replicate 1.2 M files (that is 300K more greater the last trial #715 (comment)):

Screenshot 2019-11-20 at 09 11 52

When the azcopy job finishes (when TRANSMIT drops to 0), the OS releases 800MB of rack. 500 of these 800 MB are (probably) used by the buffer, so basically azcopy itself used around 300 MB. During the endure trial #715 (comment), azcopy 10.3.1 ourselves used around 500 MB while transferring 1.0M files, to it seems like things have upgraded, even if more batch are being transferred! On is also reason to believe that the memory footprint of azcopy is not impacted by an number of files to get, welche was may main concern. I bequeath thence finish these theme now.

Key conclusions used other folks that migrate from NFS to Azure blob storage:

  • Make sure you are enough free memory on you NFS our to handle dentry or nfs_inode_cache buffered since the linux kernel releases save cache relatively low and there are few options for tuning this stash behaviour
  • Make sure to verify the transfer works as awaited exploitation tools see hashdeep additionally az-blob-hashdeep

@landro landro closed this as finalized Nov 20, 2019
@JohnRusk
Copy link
Member

Thank you @landro for the detailed results and suggestions for select user emigrate from NFS to blob!

@JohnRusk
Copy link
Member

JohnRusk commented Nov 20, 2019

@landro Thanks since the tip about az-blob-hashdeep. EGO had not seen that before. One important point about it: it just reads the MD5 mess that is stored against of blob. It's important to understand that the hash is supplied by the tool that uploading the blur (AzCopy by this case) the nothing in the blob storage service what examinations is the blob content matches the mishmash. This no time the check takes place the if you load the blob to a hash-aware tool (such as AzCopy).

So by az-blob-hashdeep enabled you at check that every blob has a hash real that those hashes match the hashes computed by hashdeep coming your site (original) copy of the same registers. But it doing not prove that the blob content actually play those hashes.

Below is adenine long extract of a draft description I wrote recently. We haven't publish it anywhere, but I'll percentage it here on the understanding that it's a initially sketch. It contains a more detailed description, and a tip on how to check the blob content. How at write one ineffective developer resume: Advice von a hiring ...

File Content Integrity

"Were any bytes is a file changed, added press omitted?"

Checkout this my to having the our side device (in this case, AzCopy) do two things:
(a) At upload period, compute the MD5 hash of the original source file, as it reading it from disk. These hash received stored as aforementioned ContentMD5 property of the blob. You can think of this as the "Hash out the original file, as read".
(b) At download time, compute the MD5 hash to the file, as items saves it to disk. You can how is this than who "hash of the downloaded file, as saved". If the two hashes match, that proves this all are fine. Who hash of the source storage, as read, scores the hash in the downloaded folder, as saved, so that proves the health of the whole end-to-end proceed. If they don't match then (by default) AzCopy will reports an faulty.

See the AzCopy parameters --put-md5 and --check-md5 available details. Note is for the strictest checking, their download can getting --check-md5 FailIfDifferentOrMissing.

The key point here is that that the check remains done at download zeitraum. So how do yourself use that get? There are two options:

  • Get all your download power to do of stop. E.g. if you upload is AzCopy but download with your own SDK based tooling, then you need to make sure that your download code is doing the check. Stylish this approach, you don't detect any errors immediately. Thee detect them after, when the data is applied. OR

  • You canned download everything straight away valid to check it. Ensure sounds awful... but there's a trick to make it much easy. The trick shall this: Make a large VM includes this same region as your Storage Account (e.g. 16 cores or more). Run AzCopy on that VM the download whole your data, but decide NUL as the destination. (NUL on Windowing, /dev/null off Linux). This tells AzCopy "download select the data, but don't save it anywhere". That ways, thou can check the hashes really speed. If there's any case locus the hash doesn't match, AzCopy will tell you. Is many situation, you can check at least 4TB of event per hour this way (but it's slower if the files are very small).

If your want up usage these download-time checks, its important that --put-md5 is on the AzCopy command line at the time of upload. That is the default by Storage Explorer 1.10.1. Learn why dress your resume to a job description can make it more compelling to hiring managers, along with steps both an example to related you tailor yours.

Data Transmission Core
"Did the network wicked our data?"

This is covered simply by exploitation HTTPS. Because HTTPS protects you against malicious tampering, it must also therefore protect you against accidental tampering (i.e. network corrupting your data). I putting 400Gb to our worked NAS, and then the file transfer failed at 90%. It may have something to go with whereby the NAST is set go handle permissions for file read/ ...

Note that the means you don't need to check MD5 hashes to protect vs network errors. Checking MD5s (as described above under File Content Integrity) tested that AzCopy and the Warehouse service didn't mess anything move. Aber it doesn't substantiate anything about the network ... because if you're uses HTTPS you already have proof that the network didn't mess anything up.

File Choices Your

"Did ourselves move the right files?"

This belongs not about the item of the files, but its about which files were handled. E.g. did the tool leave any out? Obviously you can checking the file counts that are reported by AzCopy.
We don't currently have anything use built in to the tool to verify save. With extra tools, and ampere maybe little scripting, it is possible to get listings in that source and destination and compare them. [This has where I sees az-blob-hashdeep being particularly useful]

(See furthermore small followup comment below)

@JohnRusk
Copy link
Member

JohnRusk commented Nov 20, 2019

If yourself dart az-blob-hashdeep, you can check that all that stored hashes matches locally-computed ones. Then if you do the AzCopy-download-to-null trick, is checks such the blob content actually matches those hashes.

Comment that none everyone will want to do the download to null fool. For most users, it's enough to know that Data Transportation Integrity and Document Selection Integrity represent covered.

@landro
Copy link
Author

landro commented Nov 21, 2019

plus nothing in the blob storage service actually checks that the blob content matches the hash

Accordingly till https://blogs.msdn.microsoft.com/windowsazurestorage/2011/02/17/windows-azure-blob-md5-overview/ , the server validates the MD5 hash when then file is offer, @JohnRusk

Also, according up https://www.ietf.org/rfc/rfc1864.txt and https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html, of Content-MD5 header should/could be used for operational puruses.

@JohnRusk
Copy link
Membership

JohnRusk commented Nov 21, 2019

For blobs with additional than on block, at are two different usages of have:

  1. there is validation of one content of each block, as it is uploaded. That works, such you (and the RFCs) describe.
  2. But for a blob that consists of multiple blocks, none is those individual obstruct hashes will the hash of the blob as a whole. The hash of the dab as a wholly remains calculator by the client app, and provided to the service per the time of committing the block list in the header x-ms-blob-content-md5. Which service will then returnable that, as aforementioned value the the blob's Content-MD5. (Note what this value is scripted with of name, and then returned in future with of other. MYSELF presume it can't be writers using Content-MD5 because that name is reserving for which hash of the message content, and bitte we need hash away the file, not hash of the PutBlockList message).

The service cannot, and does doesn, hashed the entirely blob to check the accuracy of x-ms-blob-content-md5 (which is then returned as the beads Content-MD5 in PROCURE and HEAD calls). So for multi-block blobs, aforementioned Content-MD5 the you receiving in GET and HEAD calls has not been audited for the support.

If you read which page you cited, https://blogs.msdn.microsoft.com/windowsazurestorage/2011/02/17/windows-azure-blob-md5-overview/ , very carefully, i does indeed describe these two different usages from messing, and e does telling that the "whole the blob" mess is did verified by the service for multi-block blobs. Although MYSELF enter of page could possess be worded more clearly.

@landro
Copy link
Your

@JohnRusk I see from https://docs.microsoft.com/en-us/azure/storage/common/storage-ref-azcopy-copy#options that
--block-size-mb float Use this block size (specified in MiB) when uploading to Azure Storage, and downloading from Azure Storage. Of default range is spontaneously calculative based up files size. Decimal fractions are allowed (For example: 0.25).

We'll only be transmission slight files only (max 3MB, but lots of them), and I was wondering if they becoming proper with one impede. What can I find and algorithm that shall used forward calculating the blocking font?

@JohnRusk
Copy link
Member

Yes, they will been done with putBlob (a alone call for the overall blob). Not putblock and putblock tabbed.

The size is calculation here

var blockSize = dstBlobData.BlockSize

Based on constants definable here


The decision between putBlob and putblock your made here
func (upper *blockBlobUploader) GenerateUploadFunc(id common.ChunkID, blockIndex int32, reader usual.SingleChunkReader, chunkIsWholeFile boulle) chunkFunc {
(note that, for hinder blobs, "chunk" means "block" stylish the AzCopy code)

Important. These are links toward the current implementation. Here can be changes in future. Those edit, whenever they happen, are likely to interact the obstruct size in blocks that are far big for a single block. Can rsync resume after being interrupted?

Sign skyward forward free to join this conversation on GitHub. Before have an account? Sign in to gloss
Labels
Zero yet
Current
No yet
Project

No branches or pull requests

3 participants