Alluxio를 로컬에 설치하고 Alluxio의 메모리에 1000 개의 파일을 삽입했습니다.
그러나 읽기 파일이 매우 느리므로 Alluxio 메모리의 파일 읽기 시간은 디스크의 파일 읽기 시간과 같습니다.Alluxio의 Spark java로 여러 파일 읽기가 느림
FileSystem fs = FileSystem.Factory.get();
AlluxioURI path = new AlluxioURI(/partition0);
List<URIStatus> status = fs.listStatus(path);
for (int i=0; i<status.size(); i++)
{
path = new AlluxioURI(status.get(i).getPath());
if(fs.exists(path)==true)
{
FileInStream in = fs.openFile(path);
String file = "";
InputStreamReader ipsr = new InputStreamReader(in);
BufferedReader br=new BufferedReader(ipsr);
String line;
line=br.readLine();
while (line != null){
//System.out.println(line);
file = file + line;
line=br.readLine();
}
byte[] cfv = file.getBytes();
br.close();
// Close file relinquishing the lock
in.close();
}
}
테스트가 1000 개 파일 파티션을 읽을 수 있기 때문에 정말 사용 지금은 스파크하지 않습니다 나는
File Name Size Block Size In-Memory Persistence State Pin Creation Time Modification Time
file1 54.73KB 512.00MB 100% NOT_PERSISTED NO 08-16-2016 12:52:31:278 08-16-2016 12:52:31:372
file2 54.73KB 512.00MB 100% NOT_PERSISTED NO 08-16-2016 12:52:31:377 08-16-2016 12:52:31:384
file3 54.72KB 512.00MB 100% NOT_PERSISTED NO 08-16-2016 12:52:31:386 08-16-2016 12:52:31:393
file4 54.71KB 512.00MB 100% NOT_PERSISTED NO 08-16-2016 12:52:31:394 08-16-2016 12:52:31:400
file5 54.72KB 512.00MB 100% NOT_PERSISTED NO 08-16-2016 12:52:31:401 08-16-2016 12:52:31:407
...
내가 파일 API와 데이터를 읽을 ... 왜 understant하지 않습니다 매우 느립니다 ... (나는 futur에서 Spark로 파티션별로 파일을 읽길 원합니다).
누군가에게 왜 읽는 것이 너무 느린지 생각해보십시오.
감사합니다. 실수를 더 잘 이해합니다. 블록 크기에 따라 최적의 블록 크기를 선택하는 규칙이 있습니까? – TiGi