File sort performance


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers File sort performance
# 1  
Old 09-21-2015
File sort performance

Hi,

I have got a 9.3GB file and it is taking 1h 8min to sort file using the following code:

Code:
sort -T /directory1 -t | -k9,9 -k8,8n /directory1/file1 > /directory2/file2

Is there a faster way of doing it please?

Thanks
Shash
# 2  
Old 09-21-2015
I hope you have escaped the delimiter like \| or "|"!?
Maybe your /directory1 is slow? What yields
Code:
df /directory1

?
# 3  
Old 09-21-2015
Hi,

I haven't used any escape character or "|".

Code:
df /directory1 yields:

Filesystem    512-blocks      Free %Used    Iused %Iused Mounted on
/directory1 17179869184 7022791168   60%   159329    10% /directory1

Thanks
Shash

Last edited by Don Cragun; 09-21-2015 at 08:52 PM.. Reason: Add CODE tags.
# 4  
Old 09-21-2015
I hoped for getting a filesystem type but this loos like a loop-back mount (and AIX).
Please give the output of
Code:
mount | awk '$1!~/:/ && $1~"/"'

# 5  
Old 09-21-2015
Code:
/dev/hd4         /                jfs2   13 Sep 18:48 rw,log=/dev/hd8
         /dev/hd2         /usr             jfs2   13 Sep 18:48 rw,log=/dev/hd8
         /dev/hd9var      /var             jfs2   13 Sep 18:48 rw,log=/dev/hd8
         /dev/hd3         /tmp             jfs2   13 Sep 18:48 rw,log=/dev/hd8
         /dev/fwdump      /var/adm/ras/platform jfs2   13 Sep 18:50 rw,log=/dev/hd8
         /dev/hd1         /home            jfs2   13 Sep 18:50 rw,log=/dev/hd8
         /dev/hd11admin   /admin           jfs2   13 Sep 18:50 rw,log=/dev/hd8
         /proc            /proc            procfs 13 Sep 18:50 rw
         /dev/hd10opt     /opt             jfs2   13 Sep 18:50 rw,log=/dev/hd8
         /dev/livedump    /var/adm/ras/livedump jfs2   13 Sep 18:50 rw,log=/dev/hd8
         /dev/fslv00      /smux            jfs2   13 Sep 18:50 rw,log=/dev/hd8
         /dev/fslv01      /home_tsg        jfs2   13 Sep 18:50 rw,log=/dev/hd8
         /dev/fslv03      /home_dba        jfs2   13 Sep 18:50 rw,log=/dev/hd8
         /dev/fslv04      /monitoring      jfs2   13 Sep 18:50 rw,log=/dev/hd8
         /dev/oraclelv    /oracle          jfs2   13 Sep 18:50 rw,log=/dev/appsloglv
         /dev/db2lv       /db2             jfs2   13 Sep 18:50 rw,log=/dev/appsloglv
         /dev/powerclv    /powercenter     jfs2   13 Sep 18:50 rw,log=/dev/appsloglv
         /dev/controlmlv  /controlm        jfs2   13 Sep 18:50 rw,log=/dev/appsloglv
         /dev/blagent     /usr/local/bl_agent jfs2   13 Sep 18:50 rw,log=/dev/hd8
         /dev/powerworklv /powerwork       jfs2   13 Sep 18:50 rw,noatime,log=INLINE
         /dev/powerdata0012 /powerdata0010   mmfs   13 Sep 18:52 rw,mtime,atime,dev=powerdata0012
         /dev/powerd0011  /powerdata0011   mmfs   13 Sep 18:52 rw,mtime,atime,dev=powerd0011
         /dev/powerd0012  /powerdata0012   mmfs   13 Sep 18:53 rw,mtime,atime,dev=powerd0012
         /dev/powerd0013  /powerdata0013   mmfs   13 Sep 18:53 rw,mtime,atime,dev=powerd0013
         /dev/powerd0015  /powerdata0015   mmfs   13 Sep 18:53 rw,mtime,atime,dev=powerd0015
         /dev/powerd0018  /powerdata0018   mmfs   13 Sep 18:53 rw,mtime,atime,dev=powerd0018
         /dev/powerd0019  /powerdata0019   mmfs   13 Sep 18:53 rw,mtime,atime,dev=powerd0019
         /dev/powerd0020  /powerdata0020   mmfs   13 Sep 18:53 rw,mtime,atime,dev=powerd0020
         /dev/powerd0021  /powerdata0021   mmfs   13 Sep 18:53 rw,mtime,atime,dev=powerd0021
         /dev/powerdata0009 /powerdata0009   mmfs   13 Sep 18:53 rw,mtime,atime,dev=powerdata0009
         /dev/powerdata0010 /powerdata0010/FMIS/SrcFiles/DM_695 mmfs   13 Sep 18:53 rw,mtime,atime,dev=powerdata0010
         /dev/powerdata0011 /powerdata0010/FMIS/SrcFiles/DW_610 mmfs   13 Sep 18:53 rw,mtime,atime,dev=powerdata0011
         /dev/powerdata0013 /powerdata0010/FMIS/SrcFiles/AP_578 mmfs   13 Sep 18:53 rw,mtime,atime,dev=powerdata0013
         /dev/powerdata0014 /powerdata0010/FMIS/SrcFiles/AP_611 mmfs   13 Sep 18:53 rw,mtime,atime,dev=powerdata0014
         /dev/powerdata0016 /powerdata0016   mmfs   13 Sep 18:53 rw,mtime,atime,dev=powerdata0016
         /dev/powerdata0017 /powerdata0017   mmfs   13 Sep 18:53 rw,mtime,atime,dev=powerdata0017
         /dev/powerdata0023 /powerdata0023   mmfs   13 Sep 18:53 rw,mtime,atime,dev=powerdata0023
         /dev/powerdata0024 /powerdata0024   mmfs   13 Sep 18:53 rw,mtime,atime,dev=powerdata0024
         /dev/common      /common          mmfs   13 Sep 18:53 rw,mtime,atime,dev=common
         /dev/ctmprod     /ctm_prod        mmfs   13 Sep 18:53 rw,mtime,atime,dev=ctmprod
         /dev/powerd0004  /powerdata0004   mmfs   13 Sep 18:53 rw,mtime,atime,dev=powerd0004
         /dev/powerd0002  /powerdata0002   mmfs   14 Sep 23:19 rw,mtime,atime,dev=powerd0002


Last edited by Corona688; 09-21-2015 at 04:17 PM.. Reason: code tags
# 6  
Old 09-21-2015
No trace of /directory1 - I give up on specific help.
In principle, the goal is to specify a fast+big temporary directory after sort's -T.
Further it might help to give a -y so the chunk size (and memory usage) is at maximum. E.g.
Code:
sort -y -T /superfastdir ...

# 7  
Old 09-21-2015
Some OS's have user-accessible RAM drives, or ssd drives mounpoints. MadeInGermany is trying to point out that sort uses disk I/O for files that big. TMPDIR or -T being the disk device where most of the sorting work happens. The fast -T directory is, the faster the sort will go.

What directory is mounted on an ssd or a fast SAN mountpoint or a RAM disk? Or even a SAS disk? I cannot tell positively what OS you are on. Please post the output of uname -a
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sort help: How to sort collected 'file list' by date stamp :

Hi Experts, I have a filelist collected from another server , now want to sort the output using date/time stamp filed. - Filed 6, 7,8 are showing the date/time/stamp. Here is the input: #---------------------------------------------------------------------- -rw------- 1 root ... (3 Replies)
Discussion started by: rveri
3 Replies

2. UNIX for Advanced & Expert Users

Script to sort the files and append the extension .sort to the sorted version of the file

Hello all - I am to this forum and fairly new in learning unix and finding some difficulty in preparing a small shell script. I am trying to make script to sort all the files given by user as input (either the exact full name of the file or say the files matching the criteria like all files... (3 Replies)
Discussion started by: pankaj80
3 Replies

3. Shell Programming and Scripting

Slow performance filtering file

Please, I need help tuning my script. It works but it's too slow. The code reads an acivity log file with 50.000 - 100.000 lines and filters error messages from it. The data in the actlog file look similar to this: 02/08/2011 00:25:01,ANR2034E QUERY MOUNT: No match found using this criteria.... (5 Replies)
Discussion started by: Miila
5 Replies

4. UNIX for Dummies Questions & Answers

I/O performance in HPUX file systems

Hi guys, what is the relation between I/O performance and file systems. I have a file systems called /dcs/data01 which is having 4Tb size. According our application we can split the file system like dcs/data01 -> 1Tb dcs/data02 -> 1Tb dcs/data03 -> 1Tb dcs/data04 -> 1Tb do you... (4 Replies)
Discussion started by: Davinzy
4 Replies

5. Shell Programming and Scripting

Performance issue in UNIX while generating .dat file from large text file

Hello Gurus, We are facing some performance issue in UNIX. If someone had faced such kind of issue in past please provide your suggestions on this . Problem Definition: /Few of load processes of our Finance Application are facing issue in UNIX when they uses a shell script having below... (19 Replies)
Discussion started by: KRAMA
19 Replies

6. UNIX for Dummies Questions & Answers

poor performance processing file with awk

Hello, I'm running a script on AIX to process lines in a file. I need to enclose the second column in quotation marks and write each line to a new file. I've come up with the following: #!/bin/ksh filename=$1 exec >> $filename.new cat $filename | while read LINE do echo $LINE | awk... (2 Replies)
Discussion started by: scooter53080
2 Replies

7. Shell Programming and Scripting

performance issue using gzcat, awk and sort

hi all, I was able to do a script to gather a few files and sort them. here it is: #!/usr/bin/ksh ls *mainFile* |cut -c20-21 | sort > temp set -A line_array i=0 file_name='temp' while read file_line do line_array=${file_line} let i=${i}+1 (5 Replies)
Discussion started by: naoseionome
5 Replies

8. Programming

File - reading - Performance improvement

Hi All I am reading a huge file of size 2GB atleast. I am reading each line and cutting certain columns and writing it to another file. Here is the logic. int main() { string u_line; string Char_List; string u_file; int line_pos; string temp_form_u_file; ... (10 Replies)
Discussion started by: dhanamurthy
10 Replies

9. News, Links, Events and Announcements

Announcing collectl - new performance linux performance monitor

About 4 years ago I wrote this tool inspired by Rob Urban's collect tool for DEC's Tru64 Unix. What makes this tool as different as collect was in its day is its ability to run at a low overhead and collect tons of stuff. I've expanded the general concept and even include data not available in... (0 Replies)
Discussion started by: MarkSeger
0 Replies

10. Programming

performance of writing into a file

Hi , I have a question about performance of writing into a file. Will it take more time to open a file, write a line into the file and close the file if the file size grows bigger and bigger?? Say, I have two files of sizes 100KB and 20MB. Will it take more time to open/write a... (1 Reply)
Discussion started by: shriashishpatil
1 Replies
Login or Register to Ask a Question