You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spark.apache.org by Jinfeng Li <li...@gmail.com> on 2015/10/26 09:57:20 UTC
Loading Files from HDFS Incurs Network Communication
Hi, I find that loading files from HDFS can incur huge amount of network
traffic. Input size is 90G and network traffic is about 80G. By my
understanding, local files should be read and thus no network communication
is needed.
I use Spark 1.5.1, and the following is my code:
val textRDD = sc.textFile("hdfs://master:9000/inputDir")
textRDD.count
Jeffrey
Re: Loading Files from HDFS Incurs Network Communication
Posted by Jinfeng Li <li...@gmail.com>.
The input data is a number of 16M files.
On Mon, Oct 26, 2015 at 5:12 PM Jinfeng Li <li...@gmail.com> wrote:
> I cat /proc/net/dev and then take the difference of received bytes before
> and after the job. I also see a long-time peak (nearly 600Mb/s) in nload
> interface. We have 18 machines and each machine receives 4.7G bytes.
>
> On Mon, Oct 26, 2015 at 5:00 PM Sean Owen <so...@cloudera.com> wrote:
>
>> -dev +user
>> How are you measuring network traffic?
>> It's not in general true that there will be zero network traffic, since
>> not all executors are local to all data. That can be the situation in many
>> cases but not always.
>>
>> On Mon, Oct 26, 2015 at 8:57 AM, Jinfeng Li <li...@gmail.com> wrote:
>>
>>> Hi, I find that loading files from HDFS can incur huge amount of network
>>> traffic. Input size is 90G and network traffic is about 80G. By my
>>> understanding, local files should be read and thus no network communication
>>> is needed.
>>>
>>> I use Spark 1.5.1, and the following is my code:
>>>
>>> val textRDD = sc.textFile("hdfs://master:9000/inputDir")
>>> textRDD.count
>>>
>>> Jeffrey
>>>
>>
>>
Re: Loading Files from HDFS Incurs Network Communication
Posted by Jinfeng Li <li...@gmail.com>.
Hi, yes, it should be the same issue, but the solution doesn't apply in our
situation. Anyway, thanks a lot for your replies.
On Mon, Oct 26, 2015 at 7:44 PM Sean Owen <so...@cloudera.com> wrote:
> Hm, now I wonder if it's the same issue here:
> https://issues.apache.org/jira/browse/SPARK-10149
>
> Does the setting described there help?
>
> On Mon, Oct 26, 2015 at 11:39 AM, Jinfeng Li <li...@gmail.com> wrote:
>
>> Hi, I have already tried the same code with Spark 1.3.1, there is no such
>> problem. The configuration files are all directly copied from Spark 1.5.1.
>> I feel it is a bug on Spark 1.5.1.
>>
>> Thanks a lot for your response.
>>
>> On Mon, Oct 26, 2015 at 7:21 PM Sean Owen <so...@cloudera.com> wrote:
>>
>>> Yeah, are these stats actually reflecting data read locally, like
>>> through the loopback interface? I'm also no expert on the internals here
>>> but this may be measuring effectively local reads. Or are you sure it's not?
>>>
>>> On Mon, Oct 26, 2015 at 11:14 AM, Steve Loughran <stevel@hortonworks.com
>>> > wrote:
>>>
>>>>
>>>> > On 26 Oct 2015, at 09:28, Jinfeng Li <li...@gmail.com> wrote:
>>>> >
>>>> > Replication factor is 3 and we have 18 data nodes. We check HDFS
>>>> webUI, data is evenly distributed among 18 machines.
>>>> >
>>>>
>>>>
>>>> every block in HDFS (usually 64-128-256 MB) is distributed across three
>>>> machines, meaning 3 machines have it local, 15 have it remote.
>>>>
>>>> for data locality to work properly, you need the executors to be
>>>> reading in the blocks of data local to them, and not data from other parts
>>>> of the files. Spark does try to do locality, but if there's only a limited
>>>> set of executors, then more of the workload is remote vs local.
>>>>
>>>> I don't know of an obvious way to get the metrics here of local vs
>>>> remote; I don't see the HDFS client library tracking that —though it should
>>>> be the place to collect stats on local/remote/domain-socket-direct IO. Does
>>>> anyone know somewhere in the Spark metrics which tracks placement locality?
>>>> If not, both layers could have some more metrics added.
>>>
>>>
>>>
>
Re: Loading Files from HDFS Incurs Network Communication
Posted by Sean Owen <so...@cloudera.com>.
Hm, now I wonder if it's the same issue here:
https://issues.apache.org/jira/browse/SPARK-10149
Does the setting described there help?
On Mon, Oct 26, 2015 at 11:39 AM, Jinfeng Li <li...@gmail.com> wrote:
> Hi, I have already tried the same code with Spark 1.3.1, there is no such
> problem. The configuration files are all directly copied from Spark 1.5.1.
> I feel it is a bug on Spark 1.5.1.
>
> Thanks a lot for your response.
>
> On Mon, Oct 26, 2015 at 7:21 PM Sean Owen <so...@cloudera.com> wrote:
>
>> Yeah, are these stats actually reflecting data read locally, like through
>> the loopback interface? I'm also no expert on the internals here but this
>> may be measuring effectively local reads. Or are you sure it's not?
>>
>> On Mon, Oct 26, 2015 at 11:14 AM, Steve Loughran <st...@hortonworks.com>
>> wrote:
>>
>>>
>>> > On 26 Oct 2015, at 09:28, Jinfeng Li <li...@gmail.com> wrote:
>>> >
>>> > Replication factor is 3 and we have 18 data nodes. We check HDFS
>>> webUI, data is evenly distributed among 18 machines.
>>> >
>>>
>>>
>>> every block in HDFS (usually 64-128-256 MB) is distributed across three
>>> machines, meaning 3 machines have it local, 15 have it remote.
>>>
>>> for data locality to work properly, you need the executors to be reading
>>> in the blocks of data local to them, and not data from other parts of the
>>> files. Spark does try to do locality, but if there's only a limited set of
>>> executors, then more of the workload is remote vs local.
>>>
>>> I don't know of an obvious way to get the metrics here of local vs
>>> remote; I don't see the HDFS client library tracking that —though it should
>>> be the place to collect stats on local/remote/domain-socket-direct IO. Does
>>> anyone know somewhere in the Spark metrics which tracks placement locality?
>>> If not, both layers could have some more metrics added.
>>
>>
>>
Re: Loading Files from HDFS Incurs Network Communication
Posted by Jinfeng Li <li...@gmail.com>.
Hi, I have already tried the same code with Spark 1.3.1, there is no such
problem. The configuration files are all directly copied from Spark 1.5.1.
I feel it is a bug on Spark 1.5.1.
Thanks a lot for your response.
On Mon, Oct 26, 2015 at 7:21 PM Sean Owen <so...@cloudera.com> wrote:
> Yeah, are these stats actually reflecting data read locally, like through
> the loopback interface? I'm also no expert on the internals here but this
> may be measuring effectively local reads. Or are you sure it's not?
>
> On Mon, Oct 26, 2015 at 11:14 AM, Steve Loughran <st...@hortonworks.com>
> wrote:
>
>>
>> > On 26 Oct 2015, at 09:28, Jinfeng Li <li...@gmail.com> wrote:
>> >
>> > Replication factor is 3 and we have 18 data nodes. We check HDFS webUI,
>> data is evenly distributed among 18 machines.
>> >
>>
>>
>> every block in HDFS (usually 64-128-256 MB) is distributed across three
>> machines, meaning 3 machines have it local, 15 have it remote.
>>
>> for data locality to work properly, you need the executors to be reading
>> in the blocks of data local to them, and not data from other parts of the
>> files. Spark does try to do locality, but if there's only a limited set of
>> executors, then more of the workload is remote vs local.
>>
>> I don't know of an obvious way to get the metrics here of local vs
>> remote; I don't see the HDFS client library tracking that —though it should
>> be the place to collect stats on local/remote/domain-socket-direct IO. Does
>> anyone know somewhere in the Spark metrics which tracks placement locality?
>> If not, both layers could have some more metrics added.
>
>
>
Re: Loading Files from HDFS Incurs Network Communication
Posted by Steve Loughran <st...@hortonworks.com>.
On 26 Oct 2015, at 11:21, Sean Owen <so...@cloudera.com>> wrote:
Yeah, are these stats actually reflecting data read locally, like through the loopback interface? I'm also no expert on the internals here but this may be measuring effectively local reads. Or are you sure it's not?
HDFS stats are really the general filesystem stats: they measure data through the input and output streams, not whether they were to/from local or remote systems. Fixable, and metrics are always good, though as Hadoop (currently) uses Hadoop metrics 2, not the codahale APIs, it's not seamless to glue it up with the spark context metric registry
On Mon, Oct 26, 2015 at 11:14 AM, Steve Loughran <st...@hortonworks.com>> wrote:
> On 26 Oct 2015, at 09:28, Jinfeng Li <li...@gmail.com>> wrote:
>
> Replication factor is 3 and we have 18 data nodes. We check HDFS webUI, data is evenly distributed among 18 machines.
>
every block in HDFS (usually 64-128-256 MB) is distributed across three machines, meaning 3 machines have it local, 15 have it remote.
for data locality to work properly, you need the executors to be reading in the blocks of data local to them, and not data from other parts of the files. Spark does try to do locality, but if there's only a limited set of executors, then more of the workload is remote vs local.
I don't know of an obvious way to get the metrics here of local vs remote; I don't see the HDFS client library tracking that —though it should be the place to collect stats on local/remote/domain-socket-direct IO. Does anyone know somewhere in the Spark metrics which tracks placement locality? If not, both layers could have some more metrics added.
Re: Loading Files from HDFS Incurs Network Communication
Posted by Sean Owen <so...@cloudera.com>.
Yeah, are these stats actually reflecting data read locally, like through
the loopback interface? I'm also no expert on the internals here but this
may be measuring effectively local reads. Or are you sure it's not?
On Mon, Oct 26, 2015 at 11:14 AM, Steve Loughran <st...@hortonworks.com>
wrote:
>
> > On 26 Oct 2015, at 09:28, Jinfeng Li <li...@gmail.com> wrote:
> >
> > Replication factor is 3 and we have 18 data nodes. We check HDFS webUI,
> data is evenly distributed among 18 machines.
> >
>
>
> every block in HDFS (usually 64-128-256 MB) is distributed across three
> machines, meaning 3 machines have it local, 15 have it remote.
>
> for data locality to work properly, you need the executors to be reading
> in the blocks of data local to them, and not data from other parts of the
> files. Spark does try to do locality, but if there's only a limited set of
> executors, then more of the workload is remote vs local.
>
> I don't know of an obvious way to get the metrics here of local vs remote;
> I don't see the HDFS client library tracking that —though it should be the
> place to collect stats on local/remote/domain-socket-direct IO. Does anyone
> know somewhere in the Spark metrics which tracks placement locality? If
> not, both layers could have some more metrics added.
Re: Loading Files from HDFS Incurs Network Communication
Posted by Steve Loughran <st...@hortonworks.com>.
> On 26 Oct 2015, at 09:28, Jinfeng Li <li...@gmail.com> wrote:
>
> Replication factor is 3 and we have 18 data nodes. We check HDFS webUI, data is evenly distributed among 18 machines.
>
every block in HDFS (usually 64-128-256 MB) is distributed across three machines, meaning 3 machines have it local, 15 have it remote.
for data locality to work properly, you need the executors to be reading in the blocks of data local to them, and not data from other parts of the files. Spark does try to do locality, but if there's only a limited set of executors, then more of the workload is remote vs local.
I don't know of an obvious way to get the metrics here of local vs remote; I don't see the HDFS client library tracking that —though it should be the place to collect stats on local/remote/domain-socket-direct IO. Does anyone know somewhere in the Spark metrics which tracks placement locality? If not, both layers could have some more metrics added.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org
Re: Loading Files from HDFS Incurs Network Communication
Posted by Jinfeng Li <li...@gmail.com>.
I use standalone mode. Each machine has 4 workers. Spark is deployed
correctly as webUI and jps command can show that.
Actually, we are a team and already use spark for nearly half a year,
started from Spark 1.3.1. We find this problem on one of our application
and I write a simple program to demonstrate that. So can spark team try
this for us? If you doesn't have this problem, we will debug by ourselves.
Jeffrey
On Mon, Oct 26, 2015 at 5:32 PM Sean Owen <so...@cloudera.com> wrote:
> Hm, how about the opposite question -- do you have just 1 executor? then
> again everything will be remote except for a small fraction of blocks.
>
> On Mon, Oct 26, 2015 at 9:28 AM, Jinfeng Li <li...@gmail.com> wrote:
>
>> Replication factor is 3 and we have 18 data nodes. We check HDFS webUI,
>> data is evenly distributed among 18 machines.
>>
>>
>> On Mon, Oct 26, 2015 at 5:18 PM Sean Owen <so...@cloudera.com> wrote:
>>
>>> Have a look at your HDFS replication, and where the blocks are for these
>>> files. For example, if you had only 2 HDFS data nodes, then data would be
>>> remote to 16 of 18 workers and always entail a copy.
>>>
>>> On Mon, Oct 26, 2015 at 9:12 AM, Jinfeng Li <li...@gmail.com> wrote:
>>>
>>>> I cat /proc/net/dev and then take the difference of received bytes
>>>> before and after the job. I also see a long-time peak (nearly 600Mb/s) in
>>>> nload interface. We have 18 machines and each machine receives 4.7G bytes.
>>>>
>>>> On Mon, Oct 26, 2015 at 5:00 PM Sean Owen <so...@cloudera.com> wrote:
>>>>
>>>>> -dev +user
>>>>> How are you measuring network traffic?
>>>>> It's not in general true that there will be zero network traffic,
>>>>> since not all executors are local to all data. That can be the situation in
>>>>> many cases but not always.
>>>>>
>>>>> On Mon, Oct 26, 2015 at 8:57 AM, Jinfeng Li <li...@gmail.com> wrote:
>>>>>
>>>>>> Hi, I find that loading files from HDFS can incur huge amount of
>>>>>> network traffic. Input size is 90G and network traffic is about 80G. By my
>>>>>> understanding, local files should be read and thus no network communication
>>>>>> is needed.
>>>>>>
>>>>>> I use Spark 1.5.1, and the following is my code:
>>>>>>
>>>>>> val textRDD = sc.textFile("hdfs://master:9000/inputDir")
>>>>>> textRDD.count
>>>>>>
>>>>>> Jeffrey
>>>>>>
>>>>>
>>>>>
>>>
>
Re: Loading Files from HDFS Incurs Network Communication
Posted by Sean Owen <so...@cloudera.com>.
Hm, how about the opposite question -- do you have just 1 executor? then
again everything will be remote except for a small fraction of blocks.
On Mon, Oct 26, 2015 at 9:28 AM, Jinfeng Li <li...@gmail.com> wrote:
> Replication factor is 3 and we have 18 data nodes. We check HDFS webUI,
> data is evenly distributed among 18 machines.
>
>
> On Mon, Oct 26, 2015 at 5:18 PM Sean Owen <so...@cloudera.com> wrote:
>
>> Have a look at your HDFS replication, and where the blocks are for these
>> files. For example, if you had only 2 HDFS data nodes, then data would be
>> remote to 16 of 18 workers and always entail a copy.
>>
>> On Mon, Oct 26, 2015 at 9:12 AM, Jinfeng Li <li...@gmail.com> wrote:
>>
>>> I cat /proc/net/dev and then take the difference of received bytes
>>> before and after the job. I also see a long-time peak (nearly 600Mb/s) in
>>> nload interface. We have 18 machines and each machine receives 4.7G bytes.
>>>
>>> On Mon, Oct 26, 2015 at 5:00 PM Sean Owen <so...@cloudera.com> wrote:
>>>
>>>> -dev +user
>>>> How are you measuring network traffic?
>>>> It's not in general true that there will be zero network traffic, since
>>>> not all executors are local to all data. That can be the situation in many
>>>> cases but not always.
>>>>
>>>> On Mon, Oct 26, 2015 at 8:57 AM, Jinfeng Li <li...@gmail.com> wrote:
>>>>
>>>>> Hi, I find that loading files from HDFS can incur huge amount of
>>>>> network traffic. Input size is 90G and network traffic is about 80G. By my
>>>>> understanding, local files should be read and thus no network communication
>>>>> is needed.
>>>>>
>>>>> I use Spark 1.5.1, and the following is my code:
>>>>>
>>>>> val textRDD = sc.textFile("hdfs://master:9000/inputDir")
>>>>> textRDD.count
>>>>>
>>>>> Jeffrey
>>>>>
>>>>
>>>>
>>
Re: Loading Files from HDFS Incurs Network Communication
Posted by Jinfeng Li <li...@gmail.com>.
Replication factor is 3 and we have 18 data nodes. We check HDFS webUI,
data is evenly distributed among 18 machines.
On Mon, Oct 26, 2015 at 5:18 PM Sean Owen <so...@cloudera.com> wrote:
> Have a look at your HDFS replication, and where the blocks are for these
> files. For example, if you had only 2 HDFS data nodes, then data would be
> remote to 16 of 18 workers and always entail a copy.
>
> On Mon, Oct 26, 2015 at 9:12 AM, Jinfeng Li <li...@gmail.com> wrote:
>
>> I cat /proc/net/dev and then take the difference of received bytes before
>> and after the job. I also see a long-time peak (nearly 600Mb/s) in nload
>> interface. We have 18 machines and each machine receives 4.7G bytes.
>>
>> On Mon, Oct 26, 2015 at 5:00 PM Sean Owen <so...@cloudera.com> wrote:
>>
>>> -dev +user
>>> How are you measuring network traffic?
>>> It's not in general true that there will be zero network traffic, since
>>> not all executors are local to all data. That can be the situation in many
>>> cases but not always.
>>>
>>> On Mon, Oct 26, 2015 at 8:57 AM, Jinfeng Li <li...@gmail.com> wrote:
>>>
>>>> Hi, I find that loading files from HDFS can incur huge amount of
>>>> network traffic. Input size is 90G and network traffic is about 80G. By my
>>>> understanding, local files should be read and thus no network communication
>>>> is needed.
>>>>
>>>> I use Spark 1.5.1, and the following is my code:
>>>>
>>>> val textRDD = sc.textFile("hdfs://master:9000/inputDir")
>>>> textRDD.count
>>>>
>>>> Jeffrey
>>>>
>>>
>>>
>
Re: Loading Files from HDFS Incurs Network Communication
Posted by Sean Owen <so...@cloudera.com>.
Have a look at your HDFS replication, and where the blocks are for these
files. For example, if you had only 2 HDFS data nodes, then data would be
remote to 16 of 18 workers and always entail a copy.
On Mon, Oct 26, 2015 at 9:12 AM, Jinfeng Li <li...@gmail.com> wrote:
> I cat /proc/net/dev and then take the difference of received bytes before
> and after the job. I also see a long-time peak (nearly 600Mb/s) in nload
> interface. We have 18 machines and each machine receives 4.7G bytes.
>
> On Mon, Oct 26, 2015 at 5:00 PM Sean Owen <so...@cloudera.com> wrote:
>
>> -dev +user
>> How are you measuring network traffic?
>> It's not in general true that there will be zero network traffic, since
>> not all executors are local to all data. That can be the situation in many
>> cases but not always.
>>
>> On Mon, Oct 26, 2015 at 8:57 AM, Jinfeng Li <li...@gmail.com> wrote:
>>
>>> Hi, I find that loading files from HDFS can incur huge amount of network
>>> traffic. Input size is 90G and network traffic is about 80G. By my
>>> understanding, local files should be read and thus no network communication
>>> is needed.
>>>
>>> I use Spark 1.5.1, and the following is my code:
>>>
>>> val textRDD = sc.textFile("hdfs://master:9000/inputDir")
>>> textRDD.count
>>>
>>> Jeffrey
>>>
>>
>>
Re: Loading Files from HDFS Incurs Network Communication
Posted by Jinfeng Li <li...@gmail.com>.
I cat /proc/net/dev and then take the difference of received bytes before
and after the job. I also see a long-time peak (nearly 600Mb/s) in nload
interface. We have 18 machines and each machine receives 4.7G bytes.
On Mon, Oct 26, 2015 at 5:00 PM Sean Owen <so...@cloudera.com> wrote:
> -dev +user
> How are you measuring network traffic?
> It's not in general true that there will be zero network traffic, since
> not all executors are local to all data. That can be the situation in many
> cases but not always.
>
> On Mon, Oct 26, 2015 at 8:57 AM, Jinfeng Li <li...@gmail.com> wrote:
>
>> Hi, I find that loading files from HDFS can incur huge amount of network
>> traffic. Input size is 90G and network traffic is about 80G. By my
>> understanding, local files should be read and thus no network communication
>> is needed.
>>
>> I use Spark 1.5.1, and the following is my code:
>>
>> val textRDD = sc.textFile("hdfs://master:9000/inputDir")
>> textRDD.count
>>
>> Jeffrey
>>
>
>
Re: Loading Files from HDFS Incurs Network Communication
Posted by Sean Owen <so...@cloudera.com>.
-dev +user
How are you measuring network traffic?
It's not in general true that there will be zero network traffic, since not
all executors are local to all data. That can be the situation in many
cases but not always.
On Mon, Oct 26, 2015 at 8:57 AM, Jinfeng Li <li...@gmail.com> wrote:
> Hi, I find that loading files from HDFS can incur huge amount of network
> traffic. Input size is 90G and network traffic is about 80G. By my
> understanding, local files should be read and thus no network communication
> is needed.
>
> I use Spark 1.5.1, and the following is my code:
>
> val textRDD = sc.textFile("hdfs://master:9000/inputDir")
> textRDD.count
>
> Jeffrey
>
Re: Loading Files from HDFS Incurs Network Communication
Posted by Sean Owen <so...@cloudera.com>.
-dev +user
How are you measuring network traffic?
It's not in general true that there will be zero network traffic, since not
all executors are local to all data. That can be the situation in many
cases but not always.
On Mon, Oct 26, 2015 at 8:57 AM, Jinfeng Li <li...@gmail.com> wrote:
> Hi, I find that loading files from HDFS can incur huge amount of network
> traffic. Input size is 90G and network traffic is about 80G. By my
> understanding, local files should be read and thus no network communication
> is needed.
>
> I use Spark 1.5.1, and the following is my code:
>
> val textRDD = sc.textFile("hdfs://master:9000/inputDir")
> textRDD.count
>
> Jeffrey
>